Mercurial > hg
changeset 10974:854ac04d712c
doc: make links for hg role
The system has a bit of smartness:
:hg:`update` -> links to hg.1.html#update
:hg:`help diffs` -> links to hg.1.html#diffs
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Fri, 23 Apr 2010 09:53:25 +0200 |
parents | 49a07f441496 |
children | db4d7077f48d |
files | doc/runrst |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/runrst Thu Apr 22 10:24:49 2010 +0200 +++ b/doc/runrst Fri Apr 23 09:53:25 2010 +0200 @@ -19,7 +19,14 @@ def role_hg(name, rawtext, text, lineno, inliner, options={}, content=[]): - node = nodes.literal(rawtext, "hg " + utils.unescape(text, True)) + text = "hg " + utils.unescape(text) + linktext = nodes.literal(rawtext, text) + parts = text.split() + cmd, args = parts[1], parts[2:] + if cmd == 'help' and args: + cmd = args[0] # link to 'dates' for 'hg help dates' + node = nodes.reference(rawtext, '', linktext, + refuri="hg.1.html#%s" % cmd) return [node], [] roles.register_local_role("hg", role_hg)