Fix autosectionlabel_maxdepth is 0 origin

This commit is contained in:
Takeshi KOMIYA 2019-02-11 18:33:42 +09:00
parent 9f3feb6315
commit 2d44232e34
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ def register_sections_as_label(app, document):
anonlabels = app.env.domaindata['std']['anonlabels'] anonlabels = app.env.domaindata['std']['anonlabels']
for node in document.traverse(nodes.section): for node in document.traverse(nodes.section):
if (app.config.autosectionlabel_maxdepth and if (app.config.autosectionlabel_maxdepth and
get_node_depth(node) > app.config.autosectionlabel_maxdepth): get_node_depth(node) >= app.config.autosectionlabel_maxdepth):
continue continue
labelid = node['ids'][0] labelid = node['ids'][0]
docname = app.env.docname docname = app.env.docname

View File

@ -71,7 +71,7 @@ def test_autosectionlabel_prefix_document_html(app, status, warning):
@pytest.mark.sphinx('html', testroot='ext-autosectionlabel', @pytest.mark.sphinx('html', testroot='ext-autosectionlabel',
confoverrides={'autosectionlabel_maxdepth': 2}) confoverrides={'autosectionlabel_maxdepth': 3})
def test_autosectionlabel_maxdepth(app, status, warning): def test_autosectionlabel_maxdepth(app, status, warning):
return test_autosectionlabel_html(app, status, warning, return test_autosectionlabel_html(app, status, warning,
skipped_labels=True) skipped_labels=True)