Mercurial > hg
comparison doc/gendoc.py @ 9158:d6eecafaf12f
doc: use reStructuredText for man and HTML pages
The Makefile now requires the rst2html and rst2man programs. Both can
be found in Debian testing or downloaded from the Docutils homepage:
http://docutils.sf.net/
http://docutils.sf.net/sandbox/manpage-writer/
The new HTML and man pages no longer contain huge amounts of
un-wrapping literal blocks, thanks to how snippets of reStructuredText
can easily be included inside other reStructuredText documents.
The HTML pages now have anchors for all sections, including the help
topics in hgrc.1 which were missing from the old HTML pages.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Thu, 16 Jul 2009 23:25:26 +0200 |
parents | 335f749cc369 |
children | d98cef25b5af |
comparison
equal
deleted
inserted
replaced
9157:9261667e9b82 | 9158:d6eecafaf12f |
---|---|
60 ui.write("%s\n%s\n%s\n" % (s, "-"*len(s), text)) | 60 ui.write("%s\n%s\n%s\n" % (s, "-"*len(s), text)) |
61 | 61 |
62 # print options | 62 # print options |
63 underlined(_("OPTIONS")) | 63 underlined(_("OPTIONS")) |
64 for optstr, desc in get_opts(globalopts): | 64 for optstr, desc in get_opts(globalopts): |
65 ui.write("%s::\n %s\n\n" % (optstr, desc)) | 65 ui.write("%s\n %s\n\n" % (optstr, desc)) |
66 | 66 |
67 # print cmds | 67 # print cmds |
68 underlined(_("COMMANDS")) | 68 underlined(_("COMMANDS")) |
69 h = {} | 69 h = {} |
70 for c, attr in table.items(): | 70 for c, attr in table.items(): |
76 | 76 |
77 for f in cmds: | 77 for f in cmds: |
78 if f.startswith("debug"): continue | 78 if f.startswith("debug"): continue |
79 d = get_cmd(h[f]) | 79 d = get_cmd(h[f]) |
80 # synopsis | 80 # synopsis |
81 ui.write("[[%s]]\n" % d['cmd']) | 81 ui.write(".. _%s:\n\n" % d['cmd']) |
82 ui.write("%s::\n" % d['synopsis'].replace("hg ","", 1)) | 82 ui.write("``%s``\n" % d['synopsis'].replace("hg ","", 1)) |
83 # description | 83 # description |
84 ui.write("%s\n\n" % d['desc'][1]) | 84 ui.write("%s\n\n" % d['desc'][1]) |
85 # options | 85 # options |
86 opt_output = list(d['opts']) | 86 opt_output = list(d['opts']) |
87 if opt_output: | 87 if opt_output: |
88 opts_len = max([len(line[0]) for line in opt_output]) | 88 opts_len = max([len(line[0]) for line in opt_output]) |
89 ui.write(_(" options:\n")) | 89 ui.write(_(" options:\n\n")) |
90 for optstr, desc in opt_output: | 90 for optstr, desc in opt_output: |
91 if desc: | 91 if desc: |
92 s = "%-*s %s" % (opts_len, optstr, desc) | 92 s = "%-*s %s" % (opts_len, optstr, desc) |
93 else: | 93 else: |
94 s = optstr | 94 s = optstr |