mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Don't use extension to add sphinx_version_info tuple to build context
This commit is contained in:
parent
ee32a53ae2
commit
e6bd3f0fc5
@ -31,10 +31,6 @@ def config_initiated(app, config):
|
||||
_('The canonical_url option is deprecated, use the html_baseurl option from Sphinx instead.')
|
||||
)
|
||||
|
||||
def page_context_handler(app, pagename, templatename, context, doctree):
|
||||
"""Expose sphinx version to html templates in a more programatic way."""
|
||||
context['sphinx_version_tuple'] = sphinx_version
|
||||
|
||||
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
|
||||
def setup(app):
|
||||
if python_version[0] < 3:
|
||||
@ -64,6 +60,4 @@ def setup(app):
|
||||
else:
|
||||
app.config.html_add_permalinks = "\uf0c1"
|
||||
|
||||
app.connect('html-page-context', page_context_handler)
|
||||
|
||||
return {'parallel_read_safe': True, 'parallel_write_safe': True}
|
||||
|
@ -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, _ver_bugfix) = sphinx_version.split('.') | map('int') -%}
|
||||
{%- set sphinx_version_info = (_ver_major, _ver_minor, _ver_bugfix) -%}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html class="{{ sphinx_writer }}" lang="{{ lang_attr }}" >
|
||||
<head>
|
||||
@ -20,7 +24,7 @@
|
||||
{%- endblock -%}
|
||||
|
||||
{#- CSS #}
|
||||
{%- if sphinx_version_tuple < (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 %}
|
||||
@ -58,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_version_tuple >= (1, 8) -%}
|
||||
{%- if sphinx_version_tuple < (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 %}
|
||||
|
Loading…
Reference in New Issue
Block a user