Mercurial > public > mercurial-scm > hg-stable
diff mercurial/minirst.py @ 10447:e957cc7cbd14
minirst: support line blocks
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sat, 13 Feb 2010 21:21:40 +0100 |
parents | e99e0e077bc4 |
children | 2853c891ac41 db2897926d14 |
line wrap: on
line diff
--- a/mercurial/minirst.py Sat Feb 13 18:44:19 2010 +0100 +++ b/mercurial/minirst.py Sat Feb 13 21:21:40 2010 +0100 @@ -111,7 +111,7 @@ i += 1 return blocks -_bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)) ') +_bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ') _optionre = re.compile(r'^(--[a-z-]+)((?:[ =][a-zA-Z][\w-]*)? +)(.*)$') _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)') _definitionre = re.compile(r'[^ ]') @@ -291,8 +291,13 @@ subsequent_indent=defindent)) initindent = subindent = indent if block['type'] == 'bullet': - m = _bulletre.match(block['lines'][0]) - subindent = indent + m.end() * ' ' + if block['lines'][0].startswith('| '): + # Remove bullet for line blocks and add no extra + # indention. + block['lines'][0] = block['lines'][0][2:] + else: + m = _bulletre.match(block['lines'][0]) + subindent = indent + m.end() * ' ' elif block['type'] == 'field': keywidth = block['keywidth'] key = block['key']