diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-01-21 11:13:51 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-01-21 11:13:51 +0100 |
commit | eb9501d7ad714a552ad9e320ea3ee9248c6c51e8 (patch) | |
tree | e90ab7e2d536015118d7b41ff5ecf18bc07c924c /exts | |
parent | 38d91ef3494d97479d3d796ac54ae86c48b4be42 (diff) | |
download | docs-eb9501d7ad714a552ad9e320ea3ee9248c6c51e8.tar.gz docs-eb9501d7ad714a552ad9e320ea3ee9248c6c51e8.tar.bz2 docs-eb9501d7ad714a552ad9e320ea3ee9248c6c51e8.zip |
Pickle references.
Diffstat (limited to 'exts')
-rw-r--r-- | exts/tsref.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/exts/tsref.py b/exts/tsref.py index da575d7a..2a45d49b 100644 --- a/exts/tsref.py +++ b/exts/tsref.py @@ -158,10 +158,6 @@ link_reg = re.compile(r"`([^`<]+)\s*(?:<([^>]+)>)?\s*`_") # since they derive from Python's tuple. token_props = {} -# Mapping from element IDs to document -# name where the ID occurs. -id_to_doc = {} - class LinkFilter(Filter): def __init__(self, app, **options): @@ -169,6 +165,7 @@ class LinkFilter(Filter): Filter.__init__(self, **options) def filter(self, lexer, stream): + id_to_doc = self.app.env.domaindata.get("_tsref", {}) for ttype, value in stream: if ttype in Token.Keyword.Type: defname = make_id('tsref-type-' + value); @@ -212,6 +209,9 @@ class LinkFilter(Filter): def remember_targets(app, doctree): docname = app.env.docname + id_to_doc = app.env.domaindata.get("_tsref", None) + if id_to_doc is None: + id_to_doc = app.env.domaindata["_tsref"] = {} for node in doctree.traverse(): if not isinstance(node, nodes.Element): continue |