Fix: special toctree entry "self" located after another entry that also has a toctree was replaced with wrong title and link. Closes #1576

Function argument variable `toctreenode` had been overrode by local variable.
This commit is contained in:
Takayuki Shimizukawa 2014-09-25 00:44:27 +09:00
parent 91507c367b
commit b7059d475d
2 changed files with 8 additions and 6 deletions

View File

@ -17,6 +17,8 @@ Bugs fixed
:rst:dir:`csv-table`. Thanks to Takeshi Komiya.
* PR#285: Test for subclasses of docutils node types when screening
searchindex. Thanks to Nathan Goldbaum.
* #1576: Special toctree entry "self" located after another entry that also has
a toctree was replaced with wrong title and link.
Release 1.2.3 (released Sep 1, 2014)

View File

@ -1279,16 +1279,16 @@ class BuildEnvironment:
subtrees = toplevel.traverse(addnodes.toctree)
toplevel[1][:] = subtrees
# resolve all sub-toctrees
for toctreenode in toc.traverse(addnodes.toctree):
if not (toctreenode.get('hidden', False)
for subtocnode in toc.traverse(addnodes.toctree):
if not (subtocnode.get('hidden', False)
and not includehidden):
i = toctreenode.parent.index(toctreenode) + 1
i = subtocnode.parent.index(subtocnode) + 1
for item in _entries_from_toctree(
toctreenode, [refdoc] + parents,
subtocnode, [refdoc] + parents,
subtree=True):
toctreenode.parent.insert(i, item)
subtocnode.parent.insert(i, item)
i += 1
toctreenode.parent.remove(toctreenode)
subtocnode.parent.remove(subtocnode)
if separate:
entries.append(toc)
else: