From 874915536997abdcba5de7488dc83813770688bd Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Mon, 13 Mar 2023 18:42:48 +0100 Subject: [PATCH 1/2] Flyout: use the new integration point Use the documented integration point for our theme. Read the official documentation at https://docs.readthedocs.io/en/stable/flyout-menu.html --- sphinx_rtd_theme/versions.html | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) 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 %} From 9300d870a70240cef5431e4019c8cfe796f2c203 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Mon, 13 Mar 2023 18:52:56 +0100 Subject: [PATCH 2/2] Templates: populate the context with all the READTHEDOCS variables --- sphinx_rtd_theme/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) 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):