Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/templatefuncs.py @ 37858:3277940a935f stable
templatefuncs: only render text portion of minirst.format() result
When "keep" argument is provided, the function returns (text, pruned), where
pruned is a list of sections from the original plain text that were pruned from
the rendered result. Let's not output it together with the rendered HTML.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Wed, 06 Jun 2018 21:19:42 +0800 |
parents | a3b4ccbec269 |
children | ead71b15efd5 |
comparison
equal
deleted
inserted
replaced
37857:ca473c05bd10 | 37858:3277940a935f |
---|---|
551 raise error.ParseError(_("rstdoc expects two arguments")) | 551 raise error.ParseError(_("rstdoc expects two arguments")) |
552 | 552 |
553 text = evalstring(context, mapping, args[0]) | 553 text = evalstring(context, mapping, args[0]) |
554 style = evalstring(context, mapping, args[1]) | 554 style = evalstring(context, mapping, args[1]) |
555 | 555 |
556 return minirst.format(text, style=style, keep=['verbose']) | 556 return minirst.format(text, style=style, keep=['verbose'])[0] |
557 | 557 |
558 @templatefunc('separate(sep, args...)', argspec='sep *args') | 558 @templatefunc('separate(sep, args...)', argspec='sep *args') |
559 def separate(context, mapping, args): | 559 def separate(context, mapping, args): |
560 """Add a separator between non-empty arguments.""" | 560 """Add a separator between non-empty arguments.""" |
561 if 'sep' not in args: | 561 if 'sep' not in args: |