changeset 12776:4f4eddee254d

gendoc: move section commands to module scope
author Martin Geisler <mg@lazybytes.net>
date Wed, 20 Oct 2010 18:07:50 +0200
parents cbbcabde2414
children a19db59e1de4
files doc/gendoc.py doc/hg.1.txt
diffstat 2 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/doc/gendoc.py	Wed Oct 20 12:29:55 2010 -0200
+++ b/doc/gendoc.py	Wed Oct 20 18:07:50 2010 +0200
@@ -58,19 +58,21 @@
 
     return d
 
+def section(ui, s):
+    ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s)))
+
+def subsection(ui, s):
+    ui.write("%s\n%s\n\n" % (s, '"' * encoding.colwidth(s)))
+
+
 def show_doc(ui):
-    def section(s):
-        ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s)))
-    def subsection(s):
-        ui.write("%s\n%s\n\n" % (s, '"' * encoding.colwidth(s)))
-
     # print options
-    section(_("Options"))
+    section(ui, _("Options"))
     for optstr, desc in get_opts(globalopts):
         ui.write("%s\n    %s\n\n" % (optstr, desc))
 
     # print cmds
-    section(_("Commands"))
+    section(ui, _("Commands"))
     commandprinter(ui, table)
 
     # print topics
@@ -78,7 +80,7 @@
         for name in names:
             ui.write(".. _%s:\n" % name)
         ui.write("\n")
-        section(sec)
+        section(ui, sec)
         if hasattr(doc, '__call__'):
             doc = doc()
         ui.write(doc)
--- a/doc/hg.1.txt	Wed Oct 20 12:29:55 2010 -0200
+++ b/doc/hg.1.txt	Wed Oct 20 18:07:50 2010 +0200
@@ -14,6 +14,7 @@
 .. contents::
    :backlinks: top
    :class: htmlonly
+   :depth: 1
 
 
 Synopsis