changeset 39307:92e9aa38a578

minirst: extract function that formats parsed blocks as plain text
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Aug 2018 11:43:05 +0900
parents 9fe97e676250
children 9b800601701c
files mercurial/minirst.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: