Skip to content

Commit

Permalink
Merge pull request #8665 from JeanKossaifi/3.x
Browse files Browse the repository at this point in the history
Cast maxdepth to int in toctree
  • Loading branch information
tk0miya committed Jan 10, 2021
2 parents d9569a8 + 169c45b commit ffba1d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sphinx/environment/adapters/toctree.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,10 @@ def get_toctree_for(self, docname: str, builder: "Builder", collapse: bool,
toctrees = [] # type: List[Element]
if 'includehidden' not in kwargs:
kwargs['includehidden'] = True
if 'maxdepth' not in kwargs:
if 'maxdepth' not in kwargs or not kwargs['maxdepth']:
kwargs['maxdepth'] = 0
else:
kwargs['maxdepth'] = int(kwargs['maxdepth'])
kwargs['collapse'] = collapse
for toctreenode in doctree.traverse(addnodes.toctree):
toctree = self.resolve(docname, builder, toctreenode, prune=True, **kwargs)
Expand Down

0 comments on commit ffba1d7

Please sign in to comment.