# HG changeset patch # User Matt Mackall # Date 2011-08-02 22:41:45 # Node ID 4a1e3c761ec78affd19a0a399df2fe64064f8ba7 # Parent ee766af457ed4d71b925c1e5aef2b7002e9e23e3 minirst: add formatblocks helper diff --git a/mercurial/minirst.py b/mercurial/minirst.py --- a/mercurial/minirst.py +++ b/mercurial/minirst.py @@ -452,6 +452,10 @@ def parse(text, indent=0, keep=None): 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 [])