Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templater.py @ 18747:f5db3092790f
hgweb: generate HTML documentation
It's generated from the raw ReST source, as returned from help.help_().
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Sat, 09 Feb 2013 21:51:21 +0000 |
parents | ef78450c8df6 |
children | 0615b22da148 |
line wrap: on
line diff
--- a/mercurial/templater.py Sat Feb 09 21:51:21 2013 +0000 +++ b/mercurial/templater.py Sat Feb 09 21:51:21 2013 +0000 @@ -9,6 +9,7 @@ import sys, os, re import util, config, templatefilters, parser, error import types +import minirst # template parsing @@ -287,6 +288,16 @@ t = stringify(args[1][0](context, mapping, args[1][1])) yield runtemplate(context, mapping, compiletemplate(t, context)) +def rstdoc(context, mapping, args): + if len(args) != 2: + # i18n: "rstdoc" is a keyword + raise error.ParseError(_("rstdoc expects two arguments")) + + text = stringify(args[0][0](context, mapping, args[0][1])) + style = stringify(args[1][0](context, mapping, args[1][1])) + + return minirst.format(text, style=style) + methods = { "string": lambda e, c: (runstring, e[1]), "symbol": lambda e, c: (runsymbol, e[1]), @@ -303,6 +314,7 @@ "ifeq": ifeq, "join": join, "label": label, + "rstdoc": rstdoc, "sub": sub, }