Skip to content

Commit

Permalink
FIX: exit if non-html builder
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Dec 12, 2023
1 parent 7bf0c3f commit c171755
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sphinx_external_toc/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ def ensure_index_file(app: Sphinx, exception: Optional[Exception]) -> None:
redirect_url = f"{root_name}.html"
elif app.builder.name == "dirhtml":
redirect_url = f"{root_name}/index.html"
else:
return

Check warning on line 337 in sphinx_external_toc/events.py

View check run for this annotation

Codecov / codecov/patch

sphinx_external_toc/events.py#L337

Added line #L337 was not covered by tests

redirect_text = f'<meta http-equiv="Refresh" content="0; url={redirect_url}" />\n'
index_path.write_text(redirect_text, encoding="utf8")
Expand Down

0 comments on commit c171755

Please sign in to comment.