Skip to content

Commit 059b26c

Browse files
authored
Merge pull request #4 from mscheltienne/dev
Fix for build on windows
2 parents 2cc2da6 + 28f26a3 commit 059b26c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

sphinx_remove_toctrees/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"""A small sphinx extension to add "copy" buttons to code blocks."""
1+
"""A small sphinx extension to remove toctrees."""
2+
23
from pathlib import Path
34
from sphinx.util import logging
45
from 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)

0 commit comments

Comments
 (0)