Roland Meister  committed 3cf08e7

Avoid recurson on invisible entries in _toctree_prune

  • Participants
  • Parent commits 1b252e5

Comments (0)

Files changed (1)

File sphinx/

                     if maxdepth > 0 and depth > maxdepth:
                         subnode.parent.replace(subnode, [])
-                        # 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):
+                        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."""