minirst: extract function that formats parsed blocks as plain text
authorYuya Nishihara <yuya@tcha.org>
Sun, 05 Aug 2018 11:43:05 +0900
changeset 39307 92e9aa38a578
parent 39306 9fe97e676250
child 39308 9b800601701c
minirst: extract function that formats parsed blocks as plain text
mercurial/minirst.py
--- a/mercurial/minirst.py	Sun Aug 05 11:39:52 2018 +0900
+++ b/mercurial/minirst.py	Sun Aug 05 11:43:05 2018 +0900
@@ -663,6 +663,10 @@
     text = ''.join(formatblock(b, width) for b in blocks)
     return text
 
+def formatplain(blocks, width):
+    """Format parsed blocks as plain text"""
+    return ''.join(formatblock(b, width) for b in blocks)
+
 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
     """Parse and format the text according to width."""
     blocks, pruned = parse(text, indent, keep or [])
@@ -671,7 +675,7 @@
     if style == 'html':
         text = formathtml(blocks)
     else:
-        text = ''.join(formatblock(b, width) for b in blocks)
+        text = formatplain(blocks, width=width)
     if keep is None:
         return text
     else: