# HG changeset patch # User Martin Geisler # Date 2010-11-16 10:10:50 # Node ID 876a931dd2305758dd36ae30c5cd03ac4633db8e # Parent 6747d4a5c45df632ddd9e6174219a7f9808263c7 minirst: better interaction between comments and margins You can now split a list with a comment: * foo .. separator * bar and the two list items will no longer be run together, that is the output is * foo * bar instead of * foo * bar diff --git a/mercurial/minirst.py b/mercurial/minirst.py --- a/mercurial/minirst.py +++ b/mercurial/minirst.py @@ -280,6 +280,8 @@ def prunecomments(blocks): b = blocks[i] if b['type'] == 'paragraph' and b['lines'][0].startswith('.. '): del blocks[i] + if i < len(blocks) and blocks[i]['type'] == 'margin': + del blocks[i] else: i += 1 return blocks @@ -397,8 +399,8 @@ def format(text, width, indent=0, keep=N blocks = hgrole(blocks) blocks = splitparagraphs(blocks) blocks = updatefieldlists(blocks) + blocks = addmargins(blocks) blocks = prunecomments(blocks) - blocks = addmargins(blocks) blocks = findadmonitions(blocks) text = '\n'.join(formatblock(b, width) for b in blocks) if keep is None: @@ -425,7 +427,7 @@ if __name__ == "__main__": blocks = debug(splitparagraphs, blocks) blocks = debug(updatefieldlists, blocks) blocks = debug(findsections, blocks) + blocks = debug(addmargins, blocks) blocks = debug(prunecomments, blocks) - blocks = debug(addmargins, blocks) blocks = debug(findadmonitions, blocks) print '\n'.join(formatblock(b, 30) for b in blocks)