changeset 15013:4a1e3c761ec7

minirst: add formatblocks helper
author Matt Mackall <mpm@selenic.com>
date Tue, 02 Aug 2011 17:41:45 -0500
parents ee766af457ed
children a814e986859f
files mercurial/minirst.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 [])