zeek/doc/ext/adapt-toc.py
Robin Sommer b10e02b691 A set of script-reference polishing.
Includes:

    - Quite a bit of CSS tweaking.

    - Some small changes to BroDoc.cc to change the order of sections.

    - A bit of tweaking some reST here and there.
2012-01-09 18:04:34 -08:00

29 lines
609 B
Python

import sys
import re
# Removes the first TOC level, which is just the page title.
def process_html_toc(app, pagename, templatename, context, doctree):
if not "toc" in context:
return
toc = context["toc"]
lines = toc.strip().split("\n")
lines = lines[2:-2]
toc = "\n".join(lines)
toc = "<ul>" + toc
context["toc"] = toc
# print >>sys.stderr, pagename
# print >>sys.stderr, context["toc"]
# print >>sys.stderr, "-----"
# print >>sys.stderr, toc
# print >>sys.stderr, "===="
def setup(app):
app.connect('html-page-context', process_html_toc)