Skip to content

Commit

Permalink
No reason to only have the first three elements from the sphinx version
Browse files Browse the repository at this point in the history
  • Loading branch information
pelson committed Sep 28, 2022
1 parent f9984d1 commit 294fc76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ install_requires =
Jinja2 <3.1
packaging
tests_require =
readthedocs-sphinx-ext
pytest

[options.extras_require]
Expand Down
2 changes: 1 addition & 1 deletion sphinx_rtd_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions sphinx_rtd_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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 %}
Expand All @@ -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 }}"/>
Expand All @@ -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 %}
Expand Down Expand Up @@ -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') }}"/>
Expand Down

0 comments on commit 294fc76

Please sign in to comment.