Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sphinx_external_toc/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ def insert_toctrees(app: Sphinx, doctree: nodes.document) -> None:
subnode["includefiles"] = []
subnode["maxdepth"] = toctree.maxdepth
subnode["caption"] = toctree.caption
# TODO this wasn't in the original code,
# but alabaster theme intermittently raised `KeyError('rawcaption')`
subnode["rawcaption"] = toctree.caption or ""
# fix #118: only set rawcaption when a caption is present
if toctree.caption:
subnode["rawcaption"] = toctree.caption
subnode["glob"] = any(isinstance(entry, GlobItem) for entry in toctree.items)
subnode["hidden"] = False if toc_placeholders else toctree.hidden
subnode["includehidden"] = False
Expand Down
15 changes: 15 additions & 0 deletions tests/_toc_files/nested_no_caption.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
defaults:
titlesonly: true
root: intro
subtrees:
- numbered: true
entries:
- file: doc1
- file: doc2
- file: doc3
subtrees:
- entries:
- file: subfolder/doc4
- url: https://example.com
meta:
regress: intro
15 changes: 15 additions & 0 deletions tests/test_parsing/test_create_toc_dict_nested_no_caption_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
entries:
- file: doc1
- file: doc2
- entries:
- file: subfolder/doc4
- url: https://example.com
file: doc3
options:
titlesonly: true
meta:
regress: intro
options:
numbered: true
titlesonly: true
root: intro
48 changes: 48 additions & 0 deletions tests/test_parsing/test_file_to_sitemap_nested_no_caption_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
documents:
doc1:
docname: doc1
subtrees: []
title: null
doc2:
docname: doc2
subtrees: []
title: null
doc3:
docname: doc3
subtrees:
- caption: null
hidden: true
items:
- subfolder/doc4
- title: null
url: https://example.com
maxdepth: -1
numbered: false
restart_numbering: null
reversed: false
style: numerical
titlesonly: true
title: null
intro:
docname: intro
subtrees:
- caption: null
hidden: true
items:
- doc1
- doc2
- doc3
maxdepth: -1
numbered: true
restart_numbering: null
reversed: false
style: numerical
titlesonly: true
title: null
subfolder/doc4:
docname: subfolder/doc4
subtrees: []
title: null
meta:
regress: intro
root: intro
2 changes: 1 addition & 1 deletion tests/test_sphinx/test_success_basic_compressed_.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<title>
Heading: intro.rst
<compound classes="toctree-wrapper">
<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="" restart_numbering="True" style="numerical" titlesonly="True">
<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" restart_numbering="True" style="numerical" titlesonly="True">
6 changes: 6 additions & 0 deletions tests/test_sphinx/test_success_nested_no_caption_.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<document source="intro">
<section ids="heading-intro-rst" names="heading:\ intro.rst">
<title>
Heading: intro.rst
<compound classes="toctree-wrapper">
<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" restart_numbering="True" style="numerical" titlesonly="True">
4 changes: 2 additions & 2 deletions tests/test_sphinx/test_success_tableofcontents_.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<title>
Heading: intro.rst
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'doc1')" glob="False" hidden="False" includefiles="doc1" includehidden="False" maxdepth="-1" numbered="0" parent="intro" rawcaption="" restart_numbering="True" style="numerical" titlesonly="False">
<toctree caption="True" entries="(None,\ 'doc1')" glob="False" hidden="False" includefiles="doc1" includehidden="False" maxdepth="-1" numbered="0" parent="intro" restart_numbering="True" style="numerical" titlesonly="False">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'doc2')" glob="False" hidden="False" includefiles="doc2" includehidden="False" maxdepth="-1" numbered="0" parent="intro" rawcaption="" restart_numbering="True" style="numerical" titlesonly="False">
<toctree caption="True" entries="(None,\ 'doc2')" glob="False" hidden="False" includefiles="doc2" includehidden="False" maxdepth="-1" numbered="0" parent="intro" restart_numbering="True" style="numerical" titlesonly="False">
7 changes: 7 additions & 0 deletions tests/test_tools/test_file_to_sitemap_nested_no_caption_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- _toc.yml
- doc1.rst
- doc2.rst
- doc3.rst
- intro.rst
- subfolder
- subfolder/doc4.rst