minirst: add formatblocks helper
authorMatt Mackall <mpm@selenic.com>
Tue, 02 Aug 2011 17:41:45 -0500
changeset 15013 4a1e3c761ec7
parent 15012 ee766af457ed
child 15014 a814e986859f
minirst: add formatblocks helper
mercurial/minirst.py
--- a/mercurial/minirst.py	Tue Aug 02 14:54:38 2011 -0500
+++ b/mercurial/minirst.py	Tue Aug 02 17:41:45 2011 -0500
@@ -452,6 +452,10 @@
     blocks = findadmonitions(blocks)
     return blocks, pruned
 
+def formatblocks(blocks, width):
+    text = '\n'.join(formatblock(b, width) for b in blocks)
+    return text
+
 def format(text, width, indent=0, keep=None):
     """Parse and format the text according to width."""
     blocks, pruned = parse(text, indent, keep or [])