Mercurial > hg > gitweb
comparison doc/gendoc.py @ 3797:54fd4d3b4fce
Generate docs for help topics
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 05 Dec 2006 16:28:59 -0600 |
parents | 7956893e8458 |
children |
comparison
equal
deleted
inserted
replaced
3796:58133ba5847d | 3797:54fd4d3b4fce |
---|---|
1 import sys, textwrap | 1 import sys, textwrap |
2 # import from the live mercurial repo | 2 # import from the live mercurial repo |
3 sys.path.insert(0, "..") | 3 sys.path.insert(0, "..") |
4 from mercurial.commands import table, globalopts | 4 from mercurial.commands import table, globalopts |
5 from mercurial.i18n import gettext as _ | 5 from mercurial.i18n import gettext as _ |
6 from mercurial.help import helptable | |
6 | 7 |
7 def get_desc(docstr): | 8 def get_desc(docstr): |
8 if not docstr: | 9 if not docstr: |
9 return "", "" | 10 return "", "" |
10 # sanitize | 11 # sanitize |
86 ui.write("\n") | 87 ui.write("\n") |
87 # aliases | 88 # aliases |
88 if d['aliases']: | 89 if d['aliases']: |
89 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) | 90 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) |
90 | 91 |
92 # print topics | |
93 for t in helptable: | |
94 l = t.split("|") | |
95 section = l[-1] | |
96 underlined(_(section).upper()) | |
97 doc = helptable[t] | |
98 if callable(doc): | |
99 doc = doc() | |
100 ui.write(_(doc)) | |
101 ui.write("\n") | |
102 | |
91 if __name__ == "__main__": | 103 if __name__ == "__main__": |
92 show_doc(sys.stdout) | 104 show_doc(sys.stdout) |