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