From af957eaa8287b106f4bc88cce9cdc1e91f6b69bd Mon Sep 17 00:00:00 2001 From: Tolga Bilbey Date: Tue, 31 Jan 2023 15:54:24 +0100 Subject: [PATCH] docs: update versions and setup.py (#1256) --- docs/_templates/layout.html | 51 ++++++++++++++++++++----------------- setup.py | 13 +++++----- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index f36e98b402..36b396935b 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -9,6 +9,10 @@ {%- set lang_attr = 'en' if language == None else (language | replace('_', '-')) %} {%- set sphinx_writer = 'writer-html5' if html5_doctype else 'writer-html4' -%} +{# Build sphinx_version_info tuple from sphinx_version string in pure Jinja #} +{%- set (_ver_major, _ver_minor) = (sphinx_version.split('.') | list)[:2] | map('int') -%} +{%- set sphinx_version_info = (_ver_major, _ver_minor, -1) -%} + @@ -20,9 +24,6 @@ {%- endblock -%} {#- CSS #} - - - {%- for css in css_files %} {%- if css|attr("rel") %} @@ -35,10 +36,14 @@ {%- endfor -%} - {#- FAVICON #} - {%- if favicon %} - - {%- endif -%} + {#- FAVICON + favicon_url is the only context var necessary since Sphinx 4. + In Sphinx<4, we use favicon but need to prepend path info. + #} + {%- set _favicon_url = favicon_url | default(pathto('_static/' + (favicon or ""), 1)) %} + {%- if favicon_url or favicon %} + + {%- endif %} {#- CANONICAL URL (deprecated) #} {%- if theme_canonical_url and not pageurl %} @@ -56,9 +61,8 @@ {%- if not embedded %} - {# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherit more blocks directly from sphinx #} - {%- if sphinx_version >= "1.8.0" -%} - + {# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #} + {%- if sphinx_version_info >= (1, 8) -%} {%- for scriptfile in script_files %} {{ js_tag(scriptfile) }} {%- endfor %} @@ -125,18 +129,16 @@
{%- block navigation %} -