From dfc569a71f3fdebff7f969872c650becc44f08d1 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 27 Feb 2018 19:32:06 -0500 Subject: [PATCH 1/3] Wrap the versions menu under a theme config In readthedocs.com/.org is not needed the usage of the bottom left versions menu, so we are making this a theme config to control it from outside. The default value is to add the menu (too keep backward compatibility). --- docs/configuring.rst | 2 ++ sphinx_rtd_theme/theme.conf | 1 + sphinx_rtd_theme/versions.html | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/configuring.rst b/docs/configuring.rst index eb382a702..0675c5477 100644 --- a/docs/configuring.rst +++ b/docs/configuring.rst @@ -25,6 +25,7 @@ file of this repository, and can be defined in your project's ``conf.py`` via 'prev_next_buttons_location': 'bottom', 'style_external_links': False, 'vcs_pageview_mode': '', + 'versions_menu': True, # Toc options 'collapse_navigation': False, 'sticky_navigation': True, @@ -49,6 +50,7 @@ Base options * ``vcs_pageview_mode`` String. Changes how to view files when using `display_github`, `display_gitlab`, etc. When using Github or Gitlab this can be: `blob` (default), `edit`, or `raw`, on Bitbucket, this can be either: `view` (default) or `edit`. +* ``versions_menu`` Bool. Whether or not to show the bottom left menu listing the versions and links to VCS repository. TOC Options ~~~~~~~~~~~ diff --git a/sphinx_rtd_theme/theme.conf b/sphinx_rtd_theme/theme.conf index 530c1cdc8..4166a9b42 100644 --- a/sphinx_rtd_theme/theme.conf +++ b/sphinx_rtd_theme/theme.conf @@ -16,3 +16,4 @@ display_version = True prev_next_buttons_location = bottom style_external_links = False vcs_pageview_mode = +versions_menu = True diff --git a/sphinx_rtd_theme/versions.html b/sphinx_rtd_theme/versions.html index 4d78287ad..cb42f5157 100644 --- a/sphinx_rtd_theme/versions.html +++ b/sphinx_rtd_theme/versions.html @@ -7,6 +7,7 @@
+ {% if theme_versions_menu %}
{{ _('Versions') }}
{% for slug, url in versions %} @@ -30,7 +31,9 @@

{% trans %}Free document hosting provided by Read the Docs.{% endtrans %} - + {% else %} + {# This content is injected by an AJAX call to readthedocs.org/readthedocs.com #} + {% endif %}
{% endif %} From e906f5116b8da577b9e3af8fe270e5c6cf4463f1 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Wed, 11 Apr 2018 19:14:04 -0400 Subject: [PATCH 2/3] Cast to bool --- sphinx_rtd_theme/versions.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_rtd_theme/versions.html b/sphinx_rtd_theme/versions.html index cb42f5157..375476cc2 100644 --- a/sphinx_rtd_theme/versions.html +++ b/sphinx_rtd_theme/versions.html @@ -7,7 +7,7 @@
- {% if theme_versions_menu %} + {% if theme_versions_menu|tobool %}
{{ _('Versions') }}
{% for slug, url in versions %} From 20c8176adc81e41b7f6de182f0053376bbbb731c Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Wed, 11 Apr 2018 19:17:08 -0400 Subject: [PATCH 3/3] Cleanup: Whitespace --- sphinx_rtd_theme/versions.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sphinx_rtd_theme/versions.html b/sphinx_rtd_theme/versions.html index 375476cc2..688747c9b 100644 --- a/sphinx_rtd_theme/versions.html +++ b/sphinx_rtd_theme/versions.html @@ -1,4 +1,4 @@ -{% if READTHEDOCS %} +{%- if READTHEDOCS %} {# Add rst-badge after rst-versions for small badge style. #}
@@ -7,18 +7,18 @@
- {% if theme_versions_menu|tobool %} + {%- if theme_versions_menu|tobool %}
{{ _('Versions') }}
- {% for slug, url in versions %} + {%- for slug, url in versions %}
{{ slug }}
- {% endfor %} + {%- endfor %}
{{ _('Downloads') }}
- {% for type, url in downloads %} + {%- for type, url in downloads %}
{{ type }}
- {% endfor %} + {%- endfor %}
{{ _('On Read the Docs') }}
@@ -30,11 +30,11 @@

- {% trans %}Free document hosting provided by Read the Docs.{% endtrans %} - {% else %} + {%- trans %}Free document hosting provided by Read the Docs.{% endtrans %} + {%- else %} {# This content is injected by an AJAX call to readthedocs.org/readthedocs.com #} - {% endif %} + {%- endif %}
-{% endif %} +{%- endif %}