mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix numbering section at singlehtml mode does not work for nested toctree
This commit is contained in:
parent
ba072ab903
commit
14107fd5de
@ -201,7 +201,8 @@ def inline_all_toctrees(builder, docnameset, docname, tree, colorfunc):
|
|||||||
sof = addnodes.start_of_file(docname=includefile)
|
sof = addnodes.start_of_file(docname=includefile)
|
||||||
sof.children = subtree.children
|
sof.children = subtree.children
|
||||||
for sectionnode in sof.traverse(nodes.section):
|
for sectionnode in sof.traverse(nodes.section):
|
||||||
sectionnode['docname'] = includefile
|
if 'docname' not in sectionnode:
|
||||||
|
sectionnode['docname'] = includefile
|
||||||
newnodes.append(sof)
|
newnodes.append(sof)
|
||||||
toctreenode.parent.replace(toctreenode, newnodes)
|
toctreenode.parent.replace(toctreenode, newnodes)
|
||||||
return tree
|
return tree
|
||||||
|
@ -11,10 +11,9 @@ Bar A
|
|||||||
|
|
||||||
should be 2.1
|
should be 2.1
|
||||||
|
|
||||||
Bar A1
|
.. toctree::
|
||||||
------
|
|
||||||
|
|
||||||
should be 2.1.1
|
baz
|
||||||
|
|
||||||
Bar B
|
Bar B
|
||||||
=====
|
=====
|
||||||
|
5
tests/roots/test-tocdepth/baz.rst
Normal file
5
tests/roots/test-tocdepth/baz.rst
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Baz A
|
||||||
|
-----
|
||||||
|
|
||||||
|
should be 2.1.1
|
||||||
|
|
@ -395,10 +395,12 @@ def test_tocdepth(app):
|
|||||||
'bar.html': [
|
'bar.html': [
|
||||||
(".//h1", '2. Bar', True),
|
(".//h1", '2. Bar', True),
|
||||||
(".//h2", '2.1. Bar A', True),
|
(".//h2", '2.1. Bar A', True),
|
||||||
(".//h3", '2.1.1. Bar A1', True),
|
|
||||||
(".//h2", '2.2. Bar B', True),
|
(".//h2", '2.2. Bar B', True),
|
||||||
(".//h3", '2.2.1. Bar B1', True),
|
(".//h3", '2.2.1. Bar B1', True),
|
||||||
],
|
],
|
||||||
|
'baz.html': [
|
||||||
|
(".//h1", '2.1.1. Baz A', True),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
for fname, paths in iteritems(expects):
|
for fname, paths in iteritems(expects):
|
||||||
@ -438,9 +440,11 @@ def test_tocdepth_singlehtml(app):
|
|||||||
# bar.rst
|
# bar.rst
|
||||||
(".//h2", '2. Bar', True),
|
(".//h2", '2. Bar', True),
|
||||||
(".//h3", '2.1. Bar A', True),
|
(".//h3", '2.1. Bar A', True),
|
||||||
(".//h4", '2.1.1. Bar A1', True),
|
|
||||||
(".//h3", '2.2. Bar B', True),
|
(".//h3", '2.2. Bar B', True),
|
||||||
(".//h4", '2.2.1. Bar B1', True),
|
(".//h4", '2.2.1. Bar B1', True),
|
||||||
|
|
||||||
|
# baz.rst
|
||||||
|
(".//h4", '2.1.1. Baz A', True),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user