[PATCH 3 of 7] minirst: extract function that formats parsed blocks as plain text

Yuya Nishihara yuya at tcha.org
Wed Aug 22 08:19:51 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1533436985 -32400
#      Sun Aug 05 11:43:05 2018 +0900
# Node ID 8c4b4d138cd4139dc5e0579bd82bf89eea8ab395
# Parent  ba490a52393234d168b28ba731de68f81f68a796
minirst: extract function that formats parsed blocks as plain text

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -663,6 +663,10 @@ def formatblocks(blocks, width):
     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 @@ def format(text, width=80, indent=0, kee
     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:


More information about the Mercurial-devel mailing list