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

Do not add HTML mixin if not building html #2076

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions src/pydata_sphinx_theme/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def setup_translators(app: Sphinx):
behavior and configuration, and _only_ add the extra bootstrap rules.
If we don't detect an HTML-based translator, then we do nothing.
"""
# Do not add the mixin if the builder format is not HTML:
if app.builder.format != "html":
return

if not app.registry.translators.items():
try:
default_translator_class = app.builder.default_translator_class
Expand All @@ -101,10 +105,6 @@ def setup_translators(app: Sphinx):
app.set_translator(app.builder.name, translator, override=True)
else:
for name, klass in app.registry.translators.items():
if app.builder.format != "html":
# Skip translators that are not HTML
continue

translator = types.new_class(
"BootstrapHTML5Translator",
(
Expand Down
Loading