summaryrefslogtreecommitdiff
path: root/sphinx/ext/autosectionlabel.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/ext/autosectionlabel.py')
-rw-r--r--sphinx/ext/autosectionlabel.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/sphinx/ext/autosectionlabel.py b/sphinx/ext/autosectionlabel.py
index 9890cdf7d..4bb401791 100644
--- a/sphinx/ext/autosectionlabel.py
+++ b/sphinx/ext/autosectionlabel.py
@@ -15,6 +15,7 @@ from docutils import nodes
from docutils.nodes import Node
from sphinx.application import Sphinx
+from sphinx.domains.std import StandardDomain
from sphinx.locale import __
from sphinx.util import logging
from sphinx.util.nodes import clean_astext
@@ -33,8 +34,7 @@ def get_node_depth(node: Node) -> int:
def register_sections_as_label(app: Sphinx, document: Node) -> None:
- labels = app.env.domaindata['std']['labels']
- anonlabels = app.env.domaindata['std']['anonlabels']
+ domain = cast(StandardDomain, app.env.get_domain('std'))
for node in document.traverse(nodes.section):
if (app.config.autosectionlabel_maxdepth and
get_node_depth(node) >= app.config.autosectionlabel_maxdepth):
@@ -49,13 +49,13 @@ def register_sections_as_label(app: Sphinx, document: Node) -> None:
name = nodes.fully_normalize_name(ref_name)
sectname = clean_astext(title)
- if name in labels:
+ if name in domain.labels:
logger.warning(__('duplicate label %s, other instance in %s'),
- name, app.env.doc2path(labels[name][0]),
+ name, app.env.doc2path(domain.labels[name][0]),
location=node, type='autosectionlabel', subtype=docname)
- anonlabels[name] = docname, labelid
- labels[name] = docname, labelid, sectname
+ domain.anonlabels[name] = docname, labelid
+ domain.labels[name] = docname, labelid, sectname
def setup(app: Sphinx) -> Dict[str, Any]: