Skip to content

Commit

Permalink
Restore TocTree.get_toctree_ancestors()
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Aug 17, 2023
1 parent 0c22d9c commit ec31853
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Bugs fixed
This will be removed in Sphinx 9.
* Restored calls to ``Builder.add_{css,js}_file()``,
which several extensions relied upon.
* Restored the private API ``TocTree.get_toctree_ancestors()``,
which several extensions relied upon.

Testing
-------
Expand Down
3 changes: 3 additions & 0 deletions sphinx/environment/adapters/toctree.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,9 @@ def resolve(self, docname: str, builder: Builder, toctree: addnodes.toctree,
includehidden=includehidden,
)

def get_toctree_ancestors(self, docname: str) -> list[str]:
return [*_get_toctree_ancestors(self.env.toctree_includes, docname)]

def get_toc_for(self, docname: str, builder: Builder) -> Node:
return document_toc(self.env, docname, self.env.app.builder.tags)

Expand Down

0 comments on commit ec31853

Please sign in to comment.