7 |
7 |
8 from i18n import _ |
8 from i18n import _ |
9 import sys, os, re |
9 import sys, os, re |
10 import util, config, templatefilters, parser, error |
10 import util, config, templatefilters, parser, error |
11 import types |
11 import types |
|
12 import minirst |
12 |
13 |
13 # template parsing |
14 # template parsing |
14 |
15 |
15 elements = { |
16 elements = { |
16 "(": (20, ("group", 1, ")"), ("func", 1, ")")), |
17 "(": (20, ("group", 1, ")"), ("func", 1, ")")), |
285 |
286 |
286 # ignore args[0] (the label string) since this is supposed to be a a no-op |
287 # ignore args[0] (the label string) since this is supposed to be a a no-op |
287 t = stringify(args[1][0](context, mapping, args[1][1])) |
288 t = stringify(args[1][0](context, mapping, args[1][1])) |
288 yield runtemplate(context, mapping, compiletemplate(t, context)) |
289 yield runtemplate(context, mapping, compiletemplate(t, context)) |
289 |
290 |
|
291 def rstdoc(context, mapping, args): |
|
292 if len(args) != 2: |
|
293 # i18n: "rstdoc" is a keyword |
|
294 raise error.ParseError(_("rstdoc expects two arguments")) |
|
295 |
|
296 text = stringify(args[0][0](context, mapping, args[0][1])) |
|
297 style = stringify(args[1][0](context, mapping, args[1][1])) |
|
298 |
|
299 return minirst.format(text, style=style) |
|
300 |
290 methods = { |
301 methods = { |
291 "string": lambda e, c: (runstring, e[1]), |
302 "string": lambda e, c: (runstring, e[1]), |
292 "symbol": lambda e, c: (runsymbol, e[1]), |
303 "symbol": lambda e, c: (runsymbol, e[1]), |
293 "group": lambda e, c: compileexp(e[1], c), |
304 "group": lambda e, c: compileexp(e[1], c), |
294 # ".": buildmember, |
305 # ".": buildmember, |