--- 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