Mercurial > public > mercurial-scm > hg
comparison doc/gendoc.py @ 12776:4f4eddee254d
gendoc: move section commands to module scope
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Wed, 20 Oct 2010 18:07:50 +0200 |
parents | 13f0acfa974a |
children | a19db59e1de4 |
comparison
equal
deleted
inserted
replaced
12775:cbbcabde2414 | 12776:4f4eddee254d |
---|---|
56 s = attr[2] | 56 s = attr[2] |
57 d['synopsis'] = s.strip() | 57 d['synopsis'] = s.strip() |
58 | 58 |
59 return d | 59 return d |
60 | 60 |
61 def section(ui, s): | |
62 ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))) | |
63 | |
64 def subsection(ui, s): | |
65 ui.write("%s\n%s\n\n" % (s, '"' * encoding.colwidth(s))) | |
66 | |
67 | |
61 def show_doc(ui): | 68 def show_doc(ui): |
62 def section(s): | |
63 ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))) | |
64 def subsection(s): | |
65 ui.write("%s\n%s\n\n" % (s, '"' * encoding.colwidth(s))) | |
66 | |
67 # print options | 69 # print options |
68 section(_("Options")) | 70 section(ui, _("Options")) |
69 for optstr, desc in get_opts(globalopts): | 71 for optstr, desc in get_opts(globalopts): |
70 ui.write("%s\n %s\n\n" % (optstr, desc)) | 72 ui.write("%s\n %s\n\n" % (optstr, desc)) |
71 | 73 |
72 # print cmds | 74 # print cmds |
73 section(_("Commands")) | 75 section(ui, _("Commands")) |
74 commandprinter(ui, table) | 76 commandprinter(ui, table) |
75 | 77 |
76 # print topics | 78 # print topics |
77 for names, sec, doc in helptable: | 79 for names, sec, doc in helptable: |
78 for name in names: | 80 for name in names: |
79 ui.write(".. _%s:\n" % name) | 81 ui.write(".. _%s:\n" % name) |
80 ui.write("\n") | 82 ui.write("\n") |
81 section(sec) | 83 section(ui, sec) |
82 if hasattr(doc, '__call__'): | 84 if hasattr(doc, '__call__'): |
83 doc = doc() | 85 doc = doc() |
84 ui.write(doc) | 86 ui.write(doc) |
85 ui.write("\n") | 87 ui.write("\n") |
86 | 88 |