##// END OF EJS Templates
help: use a full header for topic titles...
Dan Villiom Podlaski Christiansen -
r18748:6e676fb6 default
parent child Browse files
Show More
@@ -5,6 +5,7 b' sys.path.insert(0, "..")'
5 5 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
6 6 from mercurial import demandimport; demandimport.enable()
7 7 from mercurial import encoding
8 from mercurial import minirst
8 9 from mercurial.commands import table, globalopts
9 10 from mercurial.i18n import _
10 11 from mercurial.help import helptable
@@ -63,28 +64,15 b' def get_cmd(cmd, cmdtable):'
63 64
64 65 return d
65 66
66 def section(ui, s):
67 ui.write("%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s)))
68
69 def subsection(ui, s):
70 ui.write("%s\n%s\n\n" % (s, '=' * encoding.colwidth(s)))
71
72 def subsubsection(ui, s):
73 ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s)))
74
75 def subsubsubsection(ui, s):
76 ui.write("%s\n%s\n\n" % (s, "." * encoding.colwidth(s)))
77
78
79 67 def show_doc(ui):
80 68 # print options
81 section(ui, _("Options"))
69 ui.write(minirst.section(_("Options")))
82 70 for optstr, desc in get_opts(globalopts):
83 71 ui.write("%s\n %s\n\n" % (optstr, desc))
84 72
85 73 # print cmds
86 section(ui, _("Commands"))
87 commandprinter(ui, table, subsection)
74 ui.write(minirst.section(_("Commands")))
75 commandprinter(ui, table, minirst.subsection)
88 76
89 77 # print topics
90 78 for names, sec, doc in helptable:
@@ -95,13 +83,13 b' def show_doc(ui):'
95 83 for name in names:
96 84 ui.write(".. _%s:\n" % name)
97 85 ui.write("\n")
98 section(ui, sec)
86 ui.write(minirst.section(sec))
99 87 if util.safehasattr(doc, '__call__'):
100 88 doc = doc()
101 89 ui.write(doc)
102 90 ui.write("\n")
103 91
104 section(ui, _("Extensions"))
92 ui.write(minirst.section(_("Extensions")))
105 93 ui.write(_("This section contains help for extensions that are "
106 94 "distributed together with Mercurial. Help for other "
107 95 "extensions is available in the help system."))
@@ -113,12 +101,12 b' def show_doc(ui):'
113 101
114 102 for extensionname in sorted(allextensionnames()):
115 103 mod = extensions.load(None, extensionname, None)
116 subsection(ui, extensionname)
104 ui.write(minirst.subsection(extensionname))
117 105 ui.write("%s\n\n" % mod.__doc__)
118 106 cmdtable = getattr(mod, 'cmdtable', None)
119 107 if cmdtable:
120 subsubsection(ui, _('Commands'))
121 commandprinter(ui, cmdtable, subsubsubsection)
108 ui.write(minirst.subsubsection(_('Commands')))
109 commandprinter(ui, cmdtable, minirst.subsubsubsection)
122 110
123 111 def commandprinter(ui, cmdtable, sectionfunc):
124 112 h = {}
@@ -133,7 +121,7 b' def commandprinter(ui, cmdtable, section'
133 121 if f.startswith("debug"):
134 122 continue
135 123 d = get_cmd(h[f], cmdtable)
136 sectionfunc(ui, d['cmd'])
124 ui.write(sectionfunc(d['cmd']))
137 125 # synopsis
138 126 ui.write("::\n\n")
139 127 synopsislines = d['synopsis'].splitlines()
@@ -394,7 +394,8 b' def help_(ui, name, unknowncmd=False, fu'
394 394 else:
395 395 raise error.UnknownCommand(name)
396 396
397 rst = ["%s\n\n" % header]
397 rst = [minirst.section(header)]
398
398 399 # description
399 400 if not doc:
400 401 rst.append(" %s\n" % _("(no help text available)"))
@@ -22,6 +22,18 b' import re'
22 22 import util, encoding
23 23 from i18n import _
24 24
25 def section(s):
26 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
27
28 def subsection(s):
29 return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s))
30
31 def subsubsection(s):
32 return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))
33
34 def subsubsubsection(s):
35 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
36
25 37 def replace(text, substs):
26 38 '''
27 39 Apply a list of (find, replace) pairs to a text.
@@ -353,6 +353,7 b' Test help topic with same name as extens'
353 353
354 354 $ hg help multirevs
355 355 Specifying Multiple Revisions
356 """""""""""""""""""""""""""""
356 357
357 358 When Mercurial accepts more than one revision, they may be specified
358 359 individually, or provided as a topologically continuous range, separated
@@ -712,6 +712,7 b' Test a help topic'
712 712
713 713 $ hg help revs
714 714 Specifying Single Revisions
715 """""""""""""""""""""""""""
715 716
716 717 Mercurial supports several ways to specify individual revisions.
717 718
@@ -857,6 +858,7 b' Test omit indicating for help'
857 858 no commands defined
858 859 $ hg help topic-containing-verbose
859 860 This is the topic to test omit indicating.
861 """"""""""""""""""""""""""""""""""""""""""
860 862
861 863 This paragraph is never omitted (for topic).
862 864
@@ -865,6 +867,7 b' Test omit indicating for help'
865 867 use "hg help -v topic-containing-verbose" to show more complete help
866 868 $ hg help -v topic-containing-verbose
867 869 This is the topic to test omit indicating.
870 """"""""""""""""""""""""""""""""""""""""""
868 871
869 872 This paragraph is never omitted (for topic).
870 873
@@ -1728,9 +1731,7 b' Dish up an empty repo; serve it cold.'
1728 1731 files, or words in the commit message</div>
1729 1732 </form>
1730 1733 <div id="doc">
1731 <p>
1732 Specifying Single Revisions
1733 </p>
1734 <h1>Specifying Single Revisions</h1>
1734 1735 <p>
1735 1736 Mercurial supports several ways to specify individual revisions.
1736 1737 </p>
General Comments 0
You need to be logged in to leave comments. Login now