Skip to content

Commit

Permalink
Do not add HTML mixin if not building html
Browse files Browse the repository at this point in the history
  • Loading branch information
simonspa committed Dec 12, 2024
1 parent 4274105 commit e0208f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pydata_sphinx_theme/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ 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 +106,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

0 comments on commit e0208f7

Please sign in to comment.