From 4d6de11137333ede9842d535aa08b753dcb7f1b0 Mon Sep 17 00:00:00 2001 From: Benjamin Balder Bach Date: Wed, 17 May 2023 19:46:48 +0200 Subject: [PATCH] Add a call to add_js_files (sphinxcontrib.query) (#1448) * Add a call to add_js_files since it doesn't happen when loading extension from theme https://github.com/sphinx-contrib/jquery/issues/23 * Avoid importing from sphinxcontrib.jquery in __init__ * Add reference to issue --- sphinx_rtd_theme/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sphinx_rtd_theme/__init__.py b/sphinx_rtd_theme/__init__.py index 687202418..05cb1920a 100644 --- a/sphinx_rtd_theme/__init__.py +++ b/sphinx_rtd_theme/__init__.py @@ -58,6 +58,10 @@ def setup(app): # enabled at most once. # See: https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.setup_extension app.setup_extension("sphinxcontrib.jquery") + # However, we need to call the extension's callback since setup_extension doesn't do it + # See: https://github.com/sphinx-contrib/jquery/issues/23 + from sphinxcontrib.jquery import add_js_files as jquery_add_js_files + jquery_add_js_files(app, app.config) # Register the theme that can be referenced without adding a theme path app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))