# HG changeset patch # User Martin Geisler # Date 2009-11-07 02:04:46 # Node ID f52c4f7a4732e046500eeb9cf80819a911fae4e6 # Parent 5f101af4a92130266de9598022fcccc34b0ed79a minirst: prepare for general types of bullet lists The old code worked for '-' bullets only, but we can easily support variable width bullets. diff --git a/mercurial/minirst.py b/mercurial/minirst.py --- a/mercurial/minirst.py +++ b/mercurial/minirst.py @@ -94,9 +94,10 @@ def findliteralblocks(blocks): # correct for this here while we still have the original # information on the indentation of the subsequent literal # blocks available. - if blocks[i]['lines'][0].startswith('- '): - indent += 2 - adjustment -= 2 + m = _bulletre.match(blocks[i]['lines'][0]) + if m: + indent += m.end() + adjustment -= m.end() # Mark the following indented blocks. while i+1 < len(blocks) and blocks[i+1]['indent'] > indent: @@ -220,7 +221,9 @@ def formatblock(block, width): subsequent_indent=defindent)) initindent = subindent = indent if block['type'] == 'bullet': - subindent = indent + ' ' + m = _bulletre.match(block['lines'][0]) + if m: + subindent = indent + m.end() * ' ' elif block['type'] == 'field': m = _fieldre.match(block['lines'][0]) if m: