[PATCH] gendoc: add anchors for commands

Adrian Buehlmann adrian at cadifra.com
Wed Apr 23 13:30:42 CDT 2008


enables links into hg.1.html of the form: hg.1.html#command
                                                    ^^^^^^^
                                                    new!
(the patch is at the end of this email)

compare:

old:   http://www.selenic.com/mercurial/hg.1.html#clone
new:   http://www.cadifra.com/mercurial/hg.1.html#clone


asciidoc (excerpt, comment added):

'''
COMMANDS
--------

[[add]]                         <- this is new!
add [OPTION]... [FILE]...::
    Schedule files to be version controlled and added to the repository.

    The files will be added to the repository at the next commit. To
    undo an add before that, see hg revert.

    If no names are given, add all files in the repository.

    options:
    -I, --include  include names matching the given patterns
    -X, --exclude  exclude names matching the given patterns
    -n, --dry-run  do not perform actions, just print output
'''

html (comment added):

'''
<h2>COMMANDS</h2>
<a name="add"></a><dl>        <- this is new!
<dt>
add [OPTION]&#8230; [FILE]&#8230;
</dt>
<dd>
<p>
    Schedule files to be version controlled and added to the repository.
</p>
<pre>The files will be added to the repository at the next commit. To
undo an add before that, see hg revert.</pre>
<pre>If no names are given, add all files in the repository.</pre>
<pre>options:
-I, --include  include names matching the given patterns
-X, --exclude  exclude names matching the given patterns
-n, --dry-run  do not perform actions, just print output</pre>
</dd>
</dl>
'''

I've verified on FreeBSD that the man page is still fine with this.

Thanks in advance for reviewing and pushing.


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1208972415 -7200
# Node ID 76dc912aa4016fa4846e7057f6d55eaecd96669f
# Parent  3b6f18851d874ad03ad343079f87498197aa22fc
gendoc: add anchors for commands

enables links into hg.1.html of the form: hg.1.html#command

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -69,6 +69,7 @@
         if f.startswith("debug"): continue
         d = get_cmd(h[f])
         # synopsis
+        ui.write("[[%s]]\n" % d['cmd'])
         ui.write("%s::\n" % d['synopsis'].replace("hg ","", 1))
         # description
         ui.write("%s\n\n" % d['desc'][1])



More information about the Mercurial-devel mailing list