Mercurial > hg
comparison doc/gendoc.py @ 9296:5043a5b16d91
gendoc: rename underlined/bold to section/subsection
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Fri, 31 Jul 2009 11:40:03 +0200 |
parents | d98cef25b5af |
children | 3d78a6c5bdc0 |
comparison
equal
deleted
inserted
replaced
9295:b0f447a259ab | 9296:5043a5b16d91 |
---|---|
52 d['synopsis'] = s | 52 d['synopsis'] = s |
53 | 53 |
54 return d | 54 return d |
55 | 55 |
56 def show_doc(ui): | 56 def show_doc(ui): |
57 def bold(s, text=""): | 57 def section(s): |
58 ui.write("%s\n%s\n%s\n" % (s, "="*len(s), text)) | 58 ui.write("%s\n%s\n\n" % (s, "-" * len(s))) |
59 def underlined(s, text=""): | 59 def subsection(s): |
60 ui.write("%s\n%s\n%s\n" % (s, "-"*len(s), text)) | 60 ui.write("%s\n%s\n\n" % (s, '"' * len(s))) |
61 | 61 |
62 # print options | 62 # print options |
63 underlined(_("OPTIONS")) | 63 section(_("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 section(_("COMMANDS")) |
69 h = {} | 69 h = {} |
70 for c, attr in table.items(): | 70 for c, attr in table.items(): |
71 f = c.split("|")[0] | 71 f = c.split("|")[0] |
72 f = f.lstrip("^") | 72 f = f.lstrip("^") |
73 h[f] = c | 73 h[f] = c |
99 # aliases | 99 # aliases |
100 if d['aliases']: | 100 if d['aliases']: |
101 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) | 101 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) |
102 | 102 |
103 # print topics | 103 # print topics |
104 for names, section, doc in helptable: | 104 for names, sec, doc in helptable: |
105 underlined(section.upper()) | 105 section(sec.upper()) |
106 if callable(doc): | 106 if callable(doc): |
107 doc = doc() | 107 doc = doc() |
108 ui.write(doc) | 108 ui.write(doc) |
109 ui.write("\n") | 109 ui.write("\n") |
110 | 110 |