File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,16 @@ const initialiseSidebar = () => {
3636 return
3737 }
3838
39+ {# Check if we need to dynamically insert the sidebar button.
40+ # We prefer the ``sphinx_version_tuple`` variable, and if it is undefined we
41+ # know we are running a Sphinx version older than 4.2.
42+ #
43+ # See: https://www.sphinx-doc.org/en/master/development/templating.html#sphinx_version_tuple
44+ #}
45+ {% if sphinx_version_tuple is defined and sphinx_version_tuple[0] >= 5 %}
46+ const sidebarButton = document.getElementById("sidebarbutton")
47+ const sidebarArrow = sidebarButton.querySelector('span')
48+ {% else %}
3949 // create the sidebar button element
4050 const sidebarButton = document.createElement("div")
4151 sidebarButton.id = "sidebarbutton"
@@ -44,6 +54,7 @@ const initialiseSidebar = () => {
4454 sidebarArrow.innerText = "«"
4555 sidebarButton.appendChild(sidebarArrow)
4656 sidebar.appendChild(sidebarButton)
57+ {% endif %}
4758
4859 const collapse_sidebar = () => {
4960 bodyWrapper.style.marginLeft = ".8em"
You can’t perform that action at this time.
0 commit comments