Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/readthedocs/sphinx_rtd_theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Elson <philip.elson@cern.ch>2022-09-28 10:07:42 +0300
committerPhil Elson <philip.elson@cern.ch>2022-09-28 10:08:44 +0300
commitdc753f1667ba558c4119b9c87bc180bf4e68c72f (patch)
tree5a1f1346c78e35aab98c756f82327f20534d9828
parentf9984d132944e398aaa265c0eee6f9f2415c01f0 (diff)
No reason to only have the first three elements from the sphinx versiontest/pelson/fix/sphinx-version-not-three-ints
-rw-r--r--setup.cfg2
-rw-r--r--sphinx_rtd_theme/__init__.py2
-rw-r--r--sphinx_rtd_theme/layout.html12
3 files changed, 6 insertions, 10 deletions
diff --git a/setup.cfg b/setup.cfg
index f325a35..f63239a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -37,9 +37,7 @@ install_requires =
sphinx >=1.6,<6
docutils <0.18
Jinja2 <3.1
- packaging
tests_require =
- readthedocs-sphinx-ext
pytest
[options.extras_require]
diff --git a/sphinx_rtd_theme/__init__.py b/sphinx_rtd_theme/__init__.py
index f07a768..9ea323f 100644
--- a/sphinx_rtd_theme/__init__.py
+++ b/sphinx_rtd_theme/__init__.py
@@ -34,7 +34,7 @@ def config_initiated(app, config):
def extend_html_context(app, pagename, templatename, context, doctree):
# Add ``sphinx_version_info`` tuple for use in Jinja templates
- context['sphinx_version_info'] = sphinx_version[:3]
+ context['sphinx_version_info'] = sphinx_version
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
diff --git a/sphinx_rtd_theme/layout.html b/sphinx_rtd_theme/layout.html
index 6a4de94..99ec01b 100644
--- a/sphinx_rtd_theme/layout.html
+++ b/sphinx_rtd_theme/layout.html
@@ -9,8 +9,6 @@
{%- set lang_attr = 'en' if language == None else (language | replace('_', '-')) %}
{%- set sphinx_writer = 'writer-html5' if html5_doctype else 'writer-html4' -%}
-{%- set sphinx_vn = parse_version(sphinx_version) -%}
-
<!DOCTYPE html>
<html class="{{ sphinx_writer }}" lang="{{ lang_attr }}" >
<head>
@@ -22,7 +20,7 @@
{%- endblock -%}
{#- CSS #}
- {%- if sphinx_vn < parse_version("4.0") -%}
+ {%- if sphinx_version_info < (4, 0) -%}
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
{%- endif %}
@@ -40,7 +38,7 @@
{#- FAVICON #}
{%- if favicon %}
- {%- if sphinx_vn < parse_version("4.0") -%}
+ {%- if sphinx_version_info < (4, 0) -%}
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
{%- else %}
<link rel="shortcut icon" href="{{ favicon_url }}"/>
@@ -64,8 +62,8 @@
<![endif]-->
{%- if not embedded %}
{# 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_vn >= parse_version("1.8") -%}
- {%- if sphinx_vn < parse_version("4.0") -%}
+ {%- if sphinx_version_info >= (1, 8) -%}
+ {%- if sphinx_version_info < (4, 0) -%}
<script id="documentation_options" data-url_root="{{ url_root }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
{%- endif -%}
{%- for scriptfile in script_files %}
@@ -141,7 +139,7 @@
{#- Not strictly valid HTML, but it's the only way to display/scale
it properly, without weird scripting or heaps of work
#}
- {%- if sphinx_vn < parse_version("4.0") -%}
+ {%- if sphinx_version_info < (4, 0) -%}
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
{%- else %}
<img src="{{ logo_url }}" class="logo" alt="{{ _('Logo') }}"/>