File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- """A small sphinx extension to add "copy" buttons to code blocks."""
1+ """A small sphinx extension to remove toctrees."""
2+
23from pathlib import Path
34from sphinx .util import logging
45from sphinx import addnodes
@@ -30,7 +31,9 @@ def remove_toctrees(app, env):
3031 # Inputs should either be a glob pattern or a direct path so just use glob
3132 srcdir = Path (env .srcdir )
3233 for matched in srcdir .glob (pattern ):
33- to_remove .append (str (matched .relative_to (srcdir ).with_suffix ("" )))
34+ to_remove .append (
35+ str (matched .relative_to (srcdir ).with_suffix ("" ).as_posix ())
36+ )
3437
3538 # Loop through all tocs and remove the ones that match our pattern
3639 for _ , tocs in env .tocs .items ():
@@ -46,7 +49,7 @@ def remove_toctrees(app, env):
4649 toctree .attributes ["entries" ] = new_entries
4750
4851
49- def setup (app ):
52+ def setup (app ): # noqa: D103
5053 app .add_config_value ("remove_toctrees_from" , [], "html" )
5154 app .add_config_value ("remove_from_toctrees" , [], "html" )
5255 app .connect ("env-updated" , remove_toctrees )
You can’t perform that action at this time.
0 commit comments