##// END OF EJS Templates
gendoc: extract print help topics into a dedicated function...
Takumi IINO -
r19233:81d9a7f6 default
parent child Browse files
Show More
@@ -74,20 +74,9 b' def show_doc(ui):'
74 ui.write(minirst.section(_("Commands")))
74 ui.write(minirst.section(_("Commands")))
75 commandprinter(ui, table, minirst.subsection)
75 commandprinter(ui, table, minirst.subsection)
76
76
77 # print topics
77 # print help topics
78 for names, sec, doc in helptable:
78 # The config help topic is included in the hgrc.5 man page.
79 if names[0] == "config":
79 helpprinter(ui, helptable, minirst.section, exclude=['config'])
80 # The config help topic is included in the hgrc.5 man
81 # page.
82 continue
83 for name in names:
84 ui.write(".. _%s:\n" % name)
85 ui.write("\n")
86 ui.write(minirst.section(sec))
87 if util.safehasattr(doc, '__call__'):
88 doc = doc()
89 ui.write(doc)
90 ui.write("\n")
91
80
92 ui.write(minirst.section(_("Extensions")))
81 ui.write(minirst.section(_("Extensions")))
93 ui.write(_("This section contains help for extensions that are "
82 ui.write(_("This section contains help for extensions that are "
@@ -108,6 +97,22 b' def show_doc(ui):'
108 ui.write(minirst.subsubsection(_('Commands')))
97 ui.write(minirst.subsubsection(_('Commands')))
109 commandprinter(ui, cmdtable, minirst.subsubsubsection)
98 commandprinter(ui, cmdtable, minirst.subsubsubsection)
110
99
100 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
101 for names, sec, doc in helptable:
102 if exclude and names[0] in exclude:
103 continue
104 if include and names[0] not in include:
105 continue
106 for name in names:
107 ui.write(".. _%s:\n" % name)
108 ui.write("\n")
109 if sectionfunc:
110 ui.write(sectionfunc(sec))
111 if util.safehasattr(doc, '__call__'):
112 doc = doc()
113 ui.write(doc)
114 ui.write("\n")
115
111 def commandprinter(ui, cmdtable, sectionfunc):
116 def commandprinter(ui, cmdtable, sectionfunc):
112 h = {}
117 h = {}
113 for c, attr in cmdtable.items():
118 for c, attr in cmdtable.items():
General Comments 0
You need to be logged in to leave comments. Login now