|
8 | 8 | from sphinx.config import Config |
9 | 9 | from sphinx.environment import BuildEnvironment |
10 | 10 | from sphinx.errors import ExtensionError |
11 | | -from sphinx.transforms import SphinxTransform |
12 | 11 | from sphinx.util import docname_join, logging |
13 | 12 | from sphinx.util.matching import Matcher, patfilter |
14 | 13 |
|
@@ -182,34 +181,3 @@ def append_toctrees(app: Sphinx, doctree: nodes.document) -> None: |
182 | 181 | # since `TocTreeCollector.process_doc` expects it in a section |
183 | 182 | # TODO check if there is this is always ok |
184 | 183 | doctree.children[-1].extend(node_list) |
185 | | - |
186 | | - |
187 | | -# other implementations that can eventually be deleted. |
188 | | - |
189 | | - |
190 | | -class _AppendToctrees(SphinxTransform): |
191 | | - """This is not used and would be an alternate route, |
192 | | - to using the 'doctree-read' event, via`app.add_transform(_AppendToctrees)` |
193 | | - """ |
194 | | - |
195 | | - default_priority = 100 |
196 | | - |
197 | | - def apply(self, **kwargs) -> None: |
198 | | - append_toctrees(self.app, self.document) |
199 | | - |
200 | | - |
201 | | -def _modify_source(app, docname, source): |
202 | | - """This is not used, but would be the implementation if using: |
203 | | - app.connect("source-read", _modify_source) |
204 | | - """ |
205 | | - site_map = app.env.external_site_map |
206 | | - doc_item = site_map.get(app.env.docname) |
207 | | - |
208 | | - if doc_item is None or not doc_item.parts: |
209 | | - return |
210 | | - |
211 | | - for toctree in doc_item.parts: |
212 | | - entries = "\n".join( |
213 | | - entry for entry in toctree.sections if isinstance(entry, str) |
214 | | - ) |
215 | | - source[0] += f"```{{toctree}}\n{entries}\n```\n" |
0 commit comments