docs: fix linkcheck
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 6 Oct 2023 08:05:45 +0000 (10:05 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 9 Oct 2023 11:54:11 +0000 (11:54 +0000)
When running with the linkcheck builder,
app.builder.default_translator_class is None, making us throw an
exception and give up.

We don't need the bootstrap extension in this case, so just do nothing
instead.

Fixes: f72033bb707 ("docs: add bootstrap extension")
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25585>

docs/_exts/bootstrap.py

index e7239a6..bb0e595 100644 (file)
@@ -96,6 +96,9 @@ class BootstrapHTML5TranslatorMixin:
         self.body.append(tag)
 
 def setup_translators(app):
+    if app.builder.default_translator_class is None:
+        return
+
     if not app.registry.translators.items():
         translator = types.new_class(
             "BootstrapHTML5Translator",