# HG changeset patch # User Martin Geisler # Date 1274192654 -7200 # Node ID babf9a5f552899844c7fcd606f4a2db900d9ea64 # Parent c45a47bc41148b6037cd7337c4529a5e67b92222 minirst: handle line breaks in hg role diff -r c45a47bc4114 -r babf9a5f5528 mercurial/minirst.py --- a/mercurial/minirst.py Mon May 17 23:11:27 2010 +0200 +++ b/mercurial/minirst.py Tue May 18 16:24:14 2010 +0200 @@ -257,12 +257,15 @@ return blocks -_hgrolere = re.compile(r':hg:`([^`]+)`') - def hgrole(blocks): for b in blocks: if b['type'] in ('paragraph', 'section'): - b['lines'] = [_hgrolere.sub(r'"hg \1"', l) for l in b['lines']] + # Turn :hg:`command` into "hg command". This also works + # when there is a line break in the command and relies on + # the fact that we have no stray back-quotes in the input + # (run the blocks through inlineliterals first). + b['lines'] = [l.replace(':hg:`', '"hg ').replace('`', '"') + for l in b['lines']] return blocks