Skip to content

Commit

Permalink
FIX: rework 104 to support e.g. PDFHTML (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 authored Dec 12, 2023
1 parent 34d2150 commit 21adcf9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sphinx_external_toc/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,11 @@ def ensure_index_file(app: Sphinx, exception: Optional[Exception]) -> None:

root_name = remove_suffix(app.config.master_doc, app.config.source_suffix)

if app.builder.name == "html":
redirect_url = f"{root_name}.html"
elif app.builder.name == "dirhtml":
if app.builder.name == "dirhtml":
redirect_url = f"{root_name}/index.html"
else:
return
# Assume a single index for all non dir-HTML builders
redirect_url = f"{root_name}.html"

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 21adcf9

Please sign in to comment.