diff --git a/setup.cfg b/setup.cfg index f325a355e..118730593 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,7 +39,6 @@ install_requires = 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 f07a76811..9ea323f0c 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 6a4de9464..99ec01b71 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) -%} -
@@ -22,7 +20,7 @@ {%- endblock -%} {#- CSS #} - {%- if sphinx_vn < parse_version("4.0") -%} + {%- if sphinx_version_info < (4, 0) -%} {%- endif %} @@ -40,7 +38,7 @@ {#- FAVICON #} {%- if favicon %} - {%- if sphinx_vn < parse_version("4.0") -%} + {%- if sphinx_version_info < (4, 0) -%} {%- else %} @@ -64,8 +62,8 @@ {%- 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) -%} {%- 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) -%} {%- else %}