File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ def get_changed(self, previous: "SiteMap") -> Set[str]:
239
239
"""
240
240
changed_docs = set ()
241
241
# check if the root document has changed
242
- if self .root . docname != previous .root . docname :
242
+ if self .root != previous .root :
243
243
changed_docs .add (self .root .docname )
244
244
for name , doc in self ._docs .items ():
245
245
if name not in previous :
Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ def add_changed_toctrees(
131
131
"""Add docs with new or changed toctrees to changed list."""
132
132
previous_map = getattr (app .env , "external_site_map" , None )
133
133
# move external_site_map from config to env
134
+ site_map : SiteMap
134
135
app .env .external_site_map = site_map = app .config .external_site_map
135
136
# Compare to previous map, to record docnames with new or changed toctrees
136
137
if not previous_map :
@@ -287,11 +288,14 @@ def insert_toctrees(app: Sphinx, doctree: nodes.document) -> None:
287
288
288
289
if toc_placeholders :
289
290
toc_placeholders [0 ].replace_self (node_list )
290
- else :
291
+ elif doctree . children and isinstance ( doctree . children [ - 1 ], nodes . section ) :
291
292
# note here the toctree cannot not just be appended to the end of the doc,
292
293
# since `TocTreeCollector.process_doc` expects it in a section
294
+ # otherwise it will result in the child documents being on the same level as this document
293
295
# TODO check if there is this is always ok
294
296
doctree .children [- 1 ].extend (node_list )
297
+ else :
298
+ doctree .children .extend (node_list )
295
299
296
300
297
301
class InsertToctrees (SphinxTransform ):
You can’t perform that action at this time.
0 commit comments