mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Avoid recurson on invisible entries in _toctree_prune
This commit is contained in:
parent
224a76f865
commit
417aff228c
@ -1342,12 +1342,13 @@ class BuildEnvironment:
|
||||
if maxdepth > 0 and depth > maxdepth:
|
||||
subnode.parent.replace(subnode, [])
|
||||
else:
|
||||
# recurse on children, current page is already marked
|
||||
_toctree_prune(subnode, depth+1, maxdepth)
|
||||
# cull sub-entries whose parents aren't 'current'
|
||||
if (collapse and depth > 1 and
|
||||
'iscurrent' not in subnode.parent):
|
||||
subnode.parent.remove(subnode)
|
||||
else:
|
||||
# recurse on visible children
|
||||
_toctree_prune(subnode, depth+1, maxdepth)
|
||||
|
||||
def _toctree_add_classes(node, depth):
|
||||
"""Add 'toctree-l%d' and 'current' classes to the toctree."""
|
||||
|
Loading…
Reference in New Issue
Block a user