mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Closes #1722. Restore `toctree()
` template function behavior that was changed at 1.3b1.
This commit is contained in:
parent
193aadb140
commit
a9bcff7a26
1
CHANGES
1
CHANGES
@ -35,6 +35,7 @@ Bugs fixed
|
|||||||
* bizstyle theme: nested long title pages make long breadcrumb that breaks page layout.
|
* bizstyle theme: nested long title pages make long breadcrumb that breaks page layout.
|
||||||
* bizstyle theme: all breadcrumb items become 'Top' on some mobile browser
|
* bizstyle theme: all breadcrumb items become 'Top' on some mobile browser
|
||||||
(iPhone5s safari).
|
(iPhone5s safari).
|
||||||
|
* #1722: restore ``toctree()`` template function behavior that was changed at 1.3b1.
|
||||||
|
|
||||||
|
|
||||||
Release 1.3b2 (released Dec 5, 2014)
|
Release 1.3b2 (released Dec 5, 2014)
|
||||||
|
@ -1290,6 +1290,18 @@ class BuildEnvironment:
|
|||||||
# recurse on visible children
|
# recurse on visible children
|
||||||
self._toctree_prune(subnode, depth+1, maxdepth, collapse)
|
self._toctree_prune(subnode, depth+1, maxdepth, collapse)
|
||||||
|
|
||||||
|
def get_toctree_ancestors(self, docname):
|
||||||
|
parent = {}
|
||||||
|
for p, children in iteritems(self.toctree_includes):
|
||||||
|
for child in children:
|
||||||
|
parent[child] = p
|
||||||
|
ancestors = []
|
||||||
|
d = docname
|
||||||
|
while d in parent:
|
||||||
|
ancestors.append(d)
|
||||||
|
d = parent[d]
|
||||||
|
return ancestors
|
||||||
|
|
||||||
def resolve_toctree(self, docname, builder, toctree, prune=True, maxdepth=0,
|
def resolve_toctree(self, docname, builder, toctree, prune=True, maxdepth=0,
|
||||||
titles_only=False, collapse=False, includehidden=False):
|
titles_only=False, collapse=False, includehidden=False):
|
||||||
"""Resolve a *toctree* node into individual bullet lists with titles
|
"""Resolve a *toctree* node into individual bullet lists with titles
|
||||||
@ -1324,6 +1336,8 @@ class BuildEnvironment:
|
|||||||
# The transformation is made in two passes in order to avoid
|
# The transformation is made in two passes in order to avoid
|
||||||
# interactions between marking and pruning the tree (see bug #1046).
|
# interactions between marking and pruning the tree (see bug #1046).
|
||||||
|
|
||||||
|
toctree_ancestors = self.get_toctree_ancestors(docname)
|
||||||
|
|
||||||
def _toctree_add_classes(node, depth):
|
def _toctree_add_classes(node, depth):
|
||||||
"""Add 'toctree-l%d' and 'current' classes to the toctree."""
|
"""Add 'toctree-l%d' and 'current' classes to the toctree."""
|
||||||
for subnode in node.children:
|
for subnode in node.children:
|
||||||
@ -1394,7 +1408,8 @@ class BuildEnvironment:
|
|||||||
refdoc = ref
|
refdoc = ref
|
||||||
toc = self.tocs[ref].deepcopy()
|
toc = self.tocs[ref].deepcopy()
|
||||||
maxdepth = self.metadata[ref].get('tocdepth', 0)
|
maxdepth = self.metadata[ref].get('tocdepth', 0)
|
||||||
self._toctree_prune(toc, 2, maxdepth, collapse)
|
if ref not in toctree_ancestors or (prune and maxdepth > 0):
|
||||||
|
self._toctree_prune(toc, 2, maxdepth, collapse)
|
||||||
self.process_only_nodes(toc, builder, ref)
|
self.process_only_nodes(toc, builder, ref)
|
||||||
if title and toc.children and len(toc.children) == 1:
|
if title and toc.children and len(toc.children) == 1:
|
||||||
child = toc.children[0]
|
child = toc.children[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user