Mercurial > public > mercurial-scm > hg-stable
diff mercurial/minirst.py @ 10972:0a2c6948f5f4
doc, minirst: support hg interpreted text role
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Thu, 22 Apr 2010 10:04:53 +0200 |
parents | a9d5943d2a30 |
children | 287a5cdf7743 |
line wrap: on
line diff
--- a/mercurial/minirst.py Thu Apr 22 09:57:04 2010 +0200 +++ b/mercurial/minirst.py Thu Apr 22 10:04:53 2010 +0200 @@ -252,6 +252,15 @@ return blocks +_hgrolere = re.compile(r':hg:`([^`]+)`') + +def hgrole(blocks): + for b in blocks: + if b['type'] == 'paragraph': + b['lines'] = [_hgrolere.sub(r'"hg \1"', l) for l in b['lines']] + return blocks + + def addmargins(blocks): """Adds empty blocks for vertical spacing. @@ -333,6 +342,7 @@ blocks = findliteralblocks(blocks) blocks, pruned = prunecontainers(blocks, keep or []) blocks = inlineliterals(blocks) + blocks = hgrole(blocks) blocks = splitparagraphs(blocks) blocks = updatefieldlists(blocks) blocks = findsections(blocks)