--- a/mercurial/minirst.py Tue Aug 02 13:18:56 2011 +0200
+++ b/mercurial/minirst.py Tue Aug 02 14:54:38 2011 -0500
@@ -433,9 +433,9 @@
initindent=indent,
hangindent=subindent)
-
-def format(text, width, indent=0, keep=None):
- """Parse and format the text according to width."""
+def parse(text, indent=0, keep=None):
+ """Parse text into a list of blocks"""
+ pruned = []
blocks = findblocks(text)
for b in blocks:
b['indent'] += indent
@@ -450,6 +450,11 @@
blocks = addmargins(blocks)
blocks = prunecomments(blocks)
blocks = findadmonitions(blocks)
+ return blocks, pruned
+
+def format(text, width, indent=0, keep=None):
+ """Parse and format the text according to width."""
+ blocks, pruned = parse(text, indent, keep or [])
text = '\n'.join(formatblock(b, width) for b in blocks)
if keep is None:
return text