From 0c6a8173f3f234f2f746d1f9642a7f945c31d6fd Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Thu, 20 Apr 2023 22:27:46 +0100 Subject: [PATCH 1/3] Rename ``sidebar.js`` to be a static template file --- python_docs_theme/static/{sidebar.js => sidebar.js_t} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename python_docs_theme/static/{sidebar.js => sidebar.js_t} (100%) diff --git a/python_docs_theme/static/sidebar.js b/python_docs_theme/static/sidebar.js_t similarity index 100% rename from python_docs_theme/static/sidebar.js rename to python_docs_theme/static/sidebar.js_t From d5d628549a73bf527cf4559c32fa915207414b65 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Thu, 20 Apr 2023 22:28:09 +0100 Subject: [PATCH 2/3] Don't duplicate the sidebar button on Sphinx 5 and newer --- python_docs_theme/static/sidebar.js_t | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python_docs_theme/static/sidebar.js_t b/python_docs_theme/static/sidebar.js_t index 70886d4..179feae 100644 --- a/python_docs_theme/static/sidebar.js_t +++ b/python_docs_theme/static/sidebar.js_t @@ -36,6 +36,16 @@ const initialiseSidebar = () => { return } +{# Check if we need to dynamically insert the sidebar button. + # We prefer the ``sphinx_version_tuple`` variable, and if it is undefined we + # know we are running a Sphinx version older than 4.2. + # + # See: https://www.sphinx-doc.org/en/master/development/templating.html#sphinx_version_tuple + #} +{% if sphinx_version_tuple is defined and sphinx_version_tuple[0] >= 5 %} + const sidebarButton = document.getElementById("sidebarbutton") + const sidebarArrow = sidebarButton.querySelector('span') +{% else %} // create the sidebar button element const sidebarButton = document.createElement("div") sidebarButton.id = "sidebarbutton" @@ -44,6 +54,7 @@ const initialiseSidebar = () => { sidebarArrow.innerText = "«" sidebarButton.appendChild(sidebarArrow) sidebar.appendChild(sidebarButton) +{% endif %} const collapse_sidebar = () => { bodyWrapper.style.marginLeft = ".8em" From d39c3112a89023492d9f0efa9bdf7a51ca7f436d Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 20 Apr 2023 22:50:42 +0100 Subject: [PATCH 3/3] whitespace --- python_docs_theme/static/sidebar.js_t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_docs_theme/static/sidebar.js_t b/python_docs_theme/static/sidebar.js_t index 179feae..a08aa0f 100644 --- a/python_docs_theme/static/sidebar.js_t +++ b/python_docs_theme/static/sidebar.js_t @@ -45,7 +45,7 @@ const initialiseSidebar = () => { {% if sphinx_version_tuple is defined and sphinx_version_tuple[0] >= 5 %} const sidebarButton = document.getElementById("sidebarbutton") const sidebarArrow = sidebarButton.querySelector('span') -{% else %} +{% else %} // create the sidebar button element const sidebarButton = document.createElement("div") sidebarButton.id = "sidebarbutton" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy