diff options
-rw-r--r-- | exts/policyident.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/exts/policyident.py b/exts/policyident.py index 7ecc9f2..8cdc636 100644 --- a/exts/policyident.py +++ b/exts/policyident.py @@ -7,6 +7,7 @@ import collections from docutils import nodes from sphinx.domains import Index +from sphinx.environment.collectors.toctree import TocTreeCollector from sphinx.util import logging @@ -15,6 +16,8 @@ logger = logging.getLogger(__name__) Policy = collections.namedtuple('Policy', ('id', 'title', 'docname', 'chapter')) +toccollector = TocTreeCollector() + class PolicyIndex(Index): name = 'policy-index' @@ -90,6 +93,9 @@ def on_doctree_read(app, doctree): env.policy_index.append(Policy(pg_id, title, env.docname, chapter)) + # update the table of conents to use the 'pgXXXX' ids + toccollector.process_doc(app, doctree) + def on_env_purge_doc(app, env, docname): if not hasattr(env, 'policy_index'): |