Patchwork [2,of,2,STABLE] templatefuncs: only render text portion of minirst.format() result

login
register
mail settings
Submitter Anton Shestakov
Date June 6, 2018, 2:23 p.m.
Message ID <70ab2906aaf632075337.1528295011@neuro>
Download mbox | patch
Permalink /patch/31988/
State Accepted
Headers show

Comments

Anton Shestakov - June 6, 2018, 2:23 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1528291182 -28800
#      Wed Jun 06 21:19:42 2018 +0800
# Branch stable
# Node ID 70ab2906aaf6320753375f380510e19718008a63
# Parent  19878108d5dbea75c97d3dcbf7d7af5434934e13
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.
Yuya Nishihara - June 6, 2018, 2:38 p.m.
On Wed, 06 Jun 2018 22:23:31 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1528291182 -28800
> #      Wed Jun 06 21:19:42 2018 +0800
> # Branch stable
> # Node ID 70ab2906aaf6320753375f380510e19718008a63
> # Parent  19878108d5dbea75c97d3dcbf7d7af5434934e13
> templatefuncs: only render text portion of minirst.format() result

Good catch. Queued for stable, thanks.

Patch

diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py
--- a/mercurial/templatefuncs.py
+++ b/mercurial/templatefuncs.py
@@ -553,7 +553,7 @@  def rstdoc(context, mapping, args):
     text = evalstring(context, mapping, args[0])
     style = evalstring(context, mapping, args[1])
 
-    return minirst.format(text, style=style, keep=['verbose'])
+    return minirst.format(text, style=style, keep=['verbose'])[0]
 
 @templatefunc('separate(sep, args...)', argspec='sep *args')
 def separate(context, mapping, args):
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -3138,7 +3138,7 @@  Dish up an empty repo; serve it cold.
   <p>
   which will prevent the pager from running.
   </p>
-  windows
+  
   </div>
   </div>
   </div>