comparison 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
comparison
equal deleted inserted replaced
27580:34c3ea65d6d1 27581:3aa6a8135557
1254 yield {'topic': c, 'summary': doc} 1254 yield {'topic': c, 'summary': doc}
1255 1255
1256 return tmpl('helptopics', topics=topics, earlycommands=earlycommands, 1256 return tmpl('helptopics', topics=topics, earlycommands=earlycommands,
1257 othercommands=othercommands, title='Index') 1257 othercommands=othercommands, title='Index')
1258 1258
1259 # Render an index of sub-topics.
1260 if topicname in helpmod.subtopics:
1261 topics = []
1262 for entries, summary, _doc in helpmod.subtopics[topicname]:
1263 topics.append({
1264 'topic': '%s.%s' % (topicname, entries[0]),
1265 'basename': entries[0],
1266 'summary': summary,
1267 })
1268
1269 return tmpl('helptopics', topics=topics, title=topicname,
1270 subindex=True)
1271
1259 u = webutil.wsgiui() 1272 u = webutil.wsgiui()
1260 u.verbose = True 1273 u.verbose = True
1261 try: 1274 try:
1262 doc = helpmod.help_(u, topicname) 1275 doc = helpmod.help_(u, topicname)
1263 except error.UnknownCommand: 1276 except error.UnknownCommand: