diff --git a/sphinx_rtd_theme/__init__.py b/sphinx_rtd_theme/__init__.py index 687202418..07d0c80a1 100644 --- a/sphinx_rtd_theme/__init__.py +++ b/sphinx_rtd_theme/__init__.py @@ -4,6 +4,7 @@ From https://github.com/ryan-roemer/sphinx-bootstrap-theme. """ +import os from os import path from sys import version_info as python_version @@ -36,6 +37,11 @@ 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 + # Populate the context with all the READTHEDOCS variables + for variable in os.environ: + if variable.startswith('READTHEDOCS'): + context[variable] = os.environ.get(variable) + # See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package def setup(app): diff --git a/sphinx_rtd_theme/versions.html b/sphinx_rtd_theme/versions.html index bab969e64..2d41a0527 100644 --- a/sphinx_rtd_theme/versions.html +++ b/sphinx_rtd_theme/versions.html @@ -1,34 +1,3 @@ {% if READTHEDOCS %} -{# Add rst-badge after rst-versions for small badge style. #} -
- - Read the Docs - v: {{ current_version }} - - -
-
-
{{ _('Versions') }}
- {% for slug, url in versions %} -
{{ slug }}
- {% endfor %} -
-
-
{{ _('Downloads') }}
- {% for type, url in downloads %} -
{{ type }}
- {% endfor %} -
-
- {# Translators: The phrase "Read the Docs" is not translated #} -
{{ _('On Read the Docs') }}
-
- {{ _('Project Home') }} -
-
- {{ _('Builds') }} -
-
-
-
+
{% endif %}