diff --git a/CHANGES b/CHANGES index 9966e415e..698ffa014 100644 --- a/CHANGES +++ b/CHANGES @@ -186,7 +186,7 @@ Features added * #5924: githubpages: create CNAME file for custom domains when :confval:`html_baseurl` set * #4261: autosectionlabel: restrict the labeled sections by new config value; - :confval:`autosectionlabel_max_depth` + :confval:`autosectionlabel_maxdepth` Bugs fixed diff --git a/sphinx/ext/autosectionlabel.py b/sphinx/ext/autosectionlabel.py index a3267baf4..35eaa0f34 100644 --- a/sphinx/ext/autosectionlabel.py +++ b/sphinx/ext/autosectionlabel.py @@ -44,8 +44,8 @@ def register_sections_as_label(app, document): labels = app.env.domaindata['std']['labels'] anonlabels = app.env.domaindata['std']['anonlabels'] for node in document.traverse(nodes.section): - if (app.config.autosectionlabel_max_depth and - get_node_depth(node) > app.config.autosectionlabel_max_depth): + if (app.config.autosectionlabel_maxdepth and + get_node_depth(node) > app.config.autosectionlabel_maxdepth): continue labelid = node['ids'][0] docname = app.env.docname @@ -69,7 +69,7 @@ def register_sections_as_label(app, document): def setup(app): # type: (Sphinx) -> Dict[str, Any] app.add_config_value('autosectionlabel_prefix_document', False, 'env') - app.add_config_value('autosectionlabel_max_depth', None, 'env') + app.add_config_value('autosectionlabel_maxdepth', None, 'env') app.connect('doctree-read', register_sections_as_label) return { diff --git a/tests/test_ext_autosectionlabel.py b/tests/test_ext_autosectionlabel.py index cd90c23e8..6dcd9e57b 100644 --- a/tests/test_ext_autosectionlabel.py +++ b/tests/test_ext_autosectionlabel.py @@ -71,7 +71,7 @@ def test_autosectionlabel_prefix_document_html(app, status, warning): @pytest.mark.sphinx('html', testroot='ext-autosectionlabel', - confoverrides={'autosectionlabel_max_depth': 2}) -def test_autosectionlabel_max_depth(app, status, warning): + confoverrides={'autosectionlabel_maxdepth': 2}) +def test_autosectionlabel_maxdepth(app, status, warning): return test_autosectionlabel_html(app, status, warning, skipped_labels=True)