diff mercurial/hgweb/webcommands.py @ 27581:3aa6a8135557

hgweb: support rendering sub-topic indexes If the requested topic name is the name of a sub-topic, we now render an index of topics within that sub-topic.
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 30 Dec 2015 17:34:51 -0700
parents 5aa2afb4f81a
children 8f8f3b13252d
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Wed Dec 30 17:26:33 2015 -0700
+++ b/mercurial/hgweb/webcommands.py	Wed Dec 30 17:34:51 2015 -0700
@@ -1256,6 +1256,19 @@
         return tmpl('helptopics', topics=topics, earlycommands=earlycommands,
                     othercommands=othercommands, title='Index')
 
+    # Render an index of sub-topics.
+    if topicname in helpmod.subtopics:
+        topics = []
+        for entries, summary, _doc in helpmod.subtopics[topicname]:
+            topics.append({
+                'topic': '%s.%s' % (topicname, entries[0]),
+                'basename': entries[0],
+                'summary': summary,
+            })
+
+        return tmpl('helptopics', topics=topics, title=topicname,
+                    subindex=True)
+
     u = webutil.wsgiui()
     u.verbose = True
     try: