SBB: docs: nest command headers under category headers
2 files changed, 9 insertions(+), 8 deletions(-)

M doc/gendoc.py
M mercurial/minirst.py
M doc/gendoc.py +6 -8
@@ 120,7 120,7 @@ def showdoc(ui):
 
     # print cmds
     ui.write(minirst.section(_(b"Commands")))
-    commandprinter(ui, table, minirst.subsection)
+    commandprinter(ui, table, minirst.subsection, minirst.subsubsection)
 
     # print help topics
     # The config help topic is included in the hgrc.5 man page.

          
@@ 143,7 143,8 @@ def showdoc(ui):
         cmdtable = getattr(mod, 'cmdtable', None)
         if cmdtable:
             ui.write(minirst.subsubsection(_(b'Commands')))
-            commandprinter(ui, cmdtable, minirst.subsubsubsection)
+            commandprinter(ui, cmdtable, minirst.subsubsubsection,
+                    minirst.subsubsubsubsection)
 
 def showtopic(ui, topic):
     extrahelptable = [

          
@@ 177,7 178,7 @@ def helpprinter(ui, helptable, sectionfu
         ui.write(doc)
         ui.write(b"\n")
 
-def commandprinter(ui, cmdtable, sectionfunc):
+def commandprinter(ui, cmdtable, sectionfunc, subsectionfunc):
     h = {}
     for c, attr in cmdtable.items():
         f = c.split(b"|")[0]

          
@@ 202,10 203,7 @@ def commandprinter(ui, cmdtable, section
         cmds_in_category = sorted([
             cmd for cmd in cmds
             if helpcategory(cmd) == category])
-        # Print a section header for the category. Skip empty categories. For
-        # now, the category header is at the same level as the headers for the
-        # commands in the category. This is because the commands are already at
-        # man page level .SS, and there is no lower level than that.
+        # Print a section header for the category. Skip empty categories.
         if cmds_in_category:
             ui.write(sectionfunc(help.CATEGORY_NAMES[category]))
         # Print each command in the category

          
@@ 213,7 211,7 @@ def commandprinter(ui, cmdtable, section
             if f.startswith(b"debug"):
                 continue
             d = get_cmd(h[f], cmdtable)
-            ui.write(sectionfunc(d[b'cmd']))
+            ui.write(subsectionfunc(d[b'cmd']))
             # short description
             ui.write(d[b'desc'][0])
             # synopsis

          
M mercurial/minirst.py +3 -0
@@ 44,6 44,9 @@ def subsubsection(s):
 def subsubsubsection(s):
     return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
 
+def subsubsubsubsection(s):
+    return "%s\n%s\n\n" % (s, "'" * encoding.colwidth(s))
+
 def replace(text, substs):
     '''
     Apply a list of (find, replace) pairs to a text.