# HG changeset patch # User Gregory Szorc # Date 1451522091 25200 # Node ID 3aa6a8135557080db2256f3a9055d5b12692ea45 # Parent 34c3ea65d6d1d55c9188c3de4ec885ca8905c205 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. diff -r 34c3ea65d6d1 -r 3aa6a8135557 mercurial/hgweb/webcommands.py --- 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: diff -r 34c3ea65d6d1 -r 3aa6a8135557 tests/test-help.t --- a/tests/test-help.t Wed Dec 30 17:26:33 2015 -0700 +++ b/tests/test-help.t Wed Dec 30 17:34:51 2015 -0700 @@ -2631,6 +2631,82 @@ +Sub-topic indexes rendered properly + + $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals" + 200 Script output follows + + + + + + + + + + Help: internals + + + +
+ + +
+ + + + + + + + + + + + +

Topics

+ + bundles + + + container for exchange of repository data +
+ + changegroups + + + representation of revlog data +
+
+
+ + + + + + + + $ killdaemons.py #endif