Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: rework 104 to support e.g. PDFHTML #105

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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