Skip to content

Commit 4760e95

Browse files
committed
🐛 FIX: numbered: true
This was being equated to `numbered: 1` rather than `numbered: 999` (i.e. infinite depth).
1 parent 980b444 commit 4760e95

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

sphinx_external_toc/events.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ def insert_toctrees(app: Sphinx, doctree: nodes.document) -> None:
214214
subnode["glob"] = any(isinstance(entry, GlobItem) for entry in toctree.sections)
215215
subnode["hidden"] = False if toc_placeholders else toctree.hidden
216216
subnode["includehidden"] = False
217-
subnode["numbered"] = toctree.numbered
217+
subnode["numbered"] = (
218+
0
219+
if toctree.numbered is False
220+
else (999 if toctree.numbered is True else int(toctree.numbered))
221+
)
218222
subnode["titlesonly"] = toctree.titlesonly
219223
wrappernode = nodes.compound(classes=["toctree-wrapper"])
220224
wrappernode.append(subnode)

tests/test_sphinx/test_success_basic_.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
<title>
44
Heading: intro.rst
55
<compound classes="toctree-wrapper">
6-
<toctree caption="Part Caption" entries="(None,\ 'doc1') (None,\ 'doc2') (None,\ 'doc3')" glob="False" hidden="True" includefiles="doc1 doc2 doc3" includehidden="False" maxdepth="-1" numbered="True" parent="intro" rawcaption="Part Caption" titlesonly="True">
6+
<toctree caption="Part Caption" entries="(None,\ 'doc1') (None,\ 'doc2') (None,\ 'doc3')" glob="False" hidden="True" includefiles="doc1 doc2 doc3" includehidden="False" maxdepth="-1" numbered="999" parent="intro" rawcaption="Part Caption" titlesonly="True">

tests/test_sphinx/test_success_basic_compressed_.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
<title>
44
Heading: intro.rst
55
<compound classes="toctree-wrapper">
6-
<toctree caption="True" entries="(None,\ 'doc1') (None,\ 'doc2') (None,\ 'doc3')" glob="False" hidden="True" includefiles="doc1 doc2 doc3" includehidden="False" maxdepth="-1" numbered="True" parent="intro" rawcaption="" titlesonly="True">
6+
<toctree caption="True" entries="(None,\ 'doc1') (None,\ 'doc2') (None,\ 'doc3')" glob="False" hidden="True" includefiles="doc1 doc2 doc3" includehidden="False" maxdepth="-1" numbered="999" parent="intro" rawcaption="" titlesonly="True">

tests/test_sphinx/test_success_tableofcontents_.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<title>
44
Heading: intro.rst
55
<compound classes="toctree-wrapper">
6-
<toctree caption="True" entries="(None,\ 'doc1')" glob="False" hidden="False" includefiles="doc1" includehidden="False" maxdepth="-1" numbered="False" parent="intro" rawcaption="" titlesonly="True">
6+
<toctree caption="True" entries="(None,\ 'doc1')" glob="False" hidden="False" includefiles="doc1" includehidden="False" maxdepth="-1" numbered="0" parent="intro" rawcaption="" titlesonly="True">
77
<compound classes="toctree-wrapper">
8-
<toctree caption="True" entries="(None,\ 'doc2')" glob="False" hidden="False" includefiles="doc2" includehidden="False" maxdepth="-1" numbered="False" parent="intro" rawcaption="" titlesonly="True">
8+
<toctree caption="True" entries="(None,\ 'doc2')" glob="False" hidden="False" includefiles="doc2" includehidden="False" maxdepth="-1" numbered="0" parent="intro" rawcaption="" titlesonly="True">

0 commit comments

Comments
 (0)