changeset 39308:9b800601701c

help: inline minirst.format() I'm going to make minirst.format() always returns a formatted text, not text | (text, pruned).
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Aug 2018 12:06:07 +0900
parents 92e9aa38a578
children 0a766cb1092a
files mercurial/help.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help.py	Sun Aug 05 11:43:05 2018 +0900
+++ b/mercurial/help.py	Sun Aug 05 12:06:07 2018 +0900
@@ -672,8 +672,10 @@
     text = help_(ui, commands, name,
                  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
 
-    formatted, pruned = minirst.format(text, textwidth, keep=keep,
-                                       section=section)
+    blocks, pruned = minirst.parse(text, keep=keep)
+    if section:
+        blocks = minirst.filtersections(blocks, section)
+    formatted = minirst.formatplain(blocks, textwidth)
 
     # We could have been given a weird ".foo" section without a name
     # to look for, or we could have simply failed to found "foo.bar"
@@ -685,6 +687,7 @@
         keep.append('omitted')
     else:
         keep.append('notomitted')
-    formatted, pruned = minirst.format(text, textwidth, keep=keep,
-                                       section=section)
-    return formatted
+    blocks, pruned = minirst.parse(text, keep=keep)
+    if section:
+        blocks = minirst.filtersections(blocks, section)
+    return minirst.formatplain(blocks, textwidth)