From b6877075cd27d3197c74bc3e51b917290cb863f5 Mon Sep 17 00:00:00 2001 From: Simon Spannagel Date: Thu, 12 Dec 2024 07:59:37 +0100 Subject: [PATCH] Do not add HTML mixin if not building html --- src/pydata_sphinx_theme/translator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pydata_sphinx_theme/translator.py b/src/pydata_sphinx_theme/translator.py index 89bd0846b..684e10ecc 100644 --- a/src/pydata_sphinx_theme/translator.py +++ b/src/pydata_sphinx_theme/translator.py @@ -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 @@ -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", (