mercurial/hgweb/webcommands.py
changeset 27582 8f8f3b13252d
parent 27581 3aa6a8135557
child 28210 964ad57eff30
--- a/mercurial/hgweb/webcommands.py	Wed Dec 30 17:34:51 2015 -0700
+++ b/mercurial/hgweb/webcommands.py	Wed Dec 30 17:15:10 2015 -0700
@@ -1271,8 +1271,20 @@
 
     u = webutil.wsgiui()
     u.verbose = True
+
+    # Render a page from a sub-topic.
+    if '.' in topicname:
+        # TODO implement support for rendering sections, like
+        # `hg help` works.
+        topic, subtopic = topicname.split('.', 1)
+        if topic not in helpmod.subtopics:
+            raise ErrorResponse(HTTP_NOT_FOUND)
+    else:
+        topic = topicname
+        subtopic = None
+
     try:
-        doc = helpmod.help_(u, topicname)
+        doc = helpmod.help_(u, topic, subtopic=subtopic)
     except error.UnknownCommand:
         raise ErrorResponse(HTTP_NOT_FOUND)
     return tmpl('help', topic=topicname, doc=doc)