minirst: add formatblocks helper

This commit is contained in:
Matt Mackall 2011-08-02 17:41:45 -05:00
parent 8a607bdb6b
commit 9b6295af46

View File

@ -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 [])