mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
autosectionlabel: Rename confval to autosectionlabel_maxdepth
This commit is contained in:
parent
d548bf98f5
commit
4250b197c5
2
CHANGES
2
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
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user