summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2014-09-25 00:44:27 +0900
committershimizukawa <shimizukawa@gmail.com>2014-09-25 00:44:27 +0900
commitdb2aedde4597195fb087cbc37a837d0ffdfcdffe (patch)
treebc3f45a3cff757154038d46398b6605370de86d5
parent6916f237f795a5aef8c342364fabdc6f29f2bffc (diff)
downloadsphinx-db2aedde4597195fb087cbc37a837d0ffdfcdffe.tar.gz
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.
-rw-r--r--CHANGES2
-rw-r--r--sphinx/environment.py12
2 files changed, 8 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index ff5a793a..89bc6c8a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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)
diff --git a/sphinx/environment.py b/sphinx/environment.py
index bc3df2c0..463204bc 100644
--- a/sphinx/environment.py
+++ b/sphinx/environment.py
@@ -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: