From 96131f57096e7d40b45a65517e305820e2c785d7 Mon Sep 17 00:00:00 2001 From: Tremain Knight <2108488+tkknight@users.noreply.github.com> Date: Wed, 10 Feb 2021 17:05:44 +0000 Subject: [PATCH 01/21] baseline --- docs/src/_static/theme_override.css | 14 +++++++++++ docs/src/_templates/layout.html | 36 +++++++++++++++++++++++++++++ docs/src/conf.py | 6 ++++- 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/docs/src/_static/theme_override.css b/docs/src/_static/theme_override.css index 5edc286630..d98c8354d6 100644 --- a/docs/src/_static/theme_override.css +++ b/docs/src/_static/theme_override.css @@ -26,3 +26,17 @@ table.docutils td { word-wrap: break-word; } +/* Used for very strong warning */ +#slim-red-box-message { + background: #ff0000; + box-sizing: border-box; + color: #ffffff; + font-weight: normal; + padding: 0.5em; + width: 100%; +} + +#slim-red-box-message a { + color: #ffffff; + text-decoration:underline; +} diff --git a/docs/src/_templates/layout.html b/docs/src/_templates/layout.html index 9b4983697e..d191bebce6 100644 --- a/docs/src/_templates/layout.html +++ b/docs/src/_templates/layout.html @@ -1,5 +1,41 @@ {% extends "!layout.html" %} +{# This uses blocks. See: + https://www.sphinx-doc.org/en/master/templating.html +#} + +/*---------------------------------------------------------------------------*/ + +{%- block document %} + + DEBUG: version is {{ version }}. Below are two different presentations + on showing a warning message. + + {%- if (("dev" in version) or ("rc" in version)) %} +
Warning
+ You a viewing the latest unreleased documentation. + Please see the + stable + version. ++
Warning
- You a viewing the latest unreleased documentation. - Please see the + You a viewing the latest unreleased documentation + v{{ version }}. You may prefer a stable version.
Warning
- You a viewing the latest unreleased documentation + (rtd_version2) You a viewing the latest unreleased documentation v{{ version }}. You may prefer a stable version. diff --git a/docs/src/conf.py b/docs/src/conf.py index 8ebd5f120a..fddbf17459 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -43,6 +43,8 @@ def autolog(message): for item, value in os.environ.items(): autolog("[READTHEDOCS] {} = {}".format(item, value)) +# This is the version "name" rtd uses, such as: latest, stable, v3.0.1 etc +rtd_version = os.environ.get("READTHEDOCS_VERSION") # -- Path setup -------------------------------------------------------------- @@ -147,15 +149,15 @@ def autolog(message): } versionwarning_admonition_type = "tip" -versionwarning_banner_title = "Tip" -versionwarning_body_selector = 'div[itemprop="articleBody"]' +# versionwarning_banner_title = "Tip" +# versionwarning_body_selector = 'div[itemprop="articleBody"]' # === # Show warning at top of page # versionwarning_body_selector = "div.document" # versionwarning_banner_title = "" # For debugging locally -# versionwarning_project_version = "latest" +versionwarning_project_version = "latest" # -- panels extension --------------------------------------------------------- # See https://sphinx-panels.readthedocs.io/en/latest/ @@ -253,6 +255,7 @@ def autolog(message): } html_context = { + "rtd_version": rtd_version, "version": version, "copyright_years": copyright_years, "python_version": build_python_version, diff --git a/requirements/ci/py37.yml b/requirements/ci/py37.yml index 62f0a2c3f3..bdb097796a 100644 --- a/requirements/ci/py37.yml +++ b/requirements/ci/py37.yml @@ -49,5 +49,3 @@ dependencies: - sphinx-gallery - sphinx-panels - sphinx_rtd_theme - - pip: - - sphinx-version-warning \ No newline at end of file From 706a8fdcb00cf62e924b723f0c5b9f0454a5b9a9 Mon Sep 17 00:00:00 2001 From: Tremain Knight <2108488+tkknight@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:42:41 +0000 Subject: [PATCH 08/21] fixed if --- docs/src/_templates/layout.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/_templates/layout.html b/docs/src/_templates/layout.html index ee9aef6ec5..b69d01d330 100644 --- a/docs/src/_templates/layout.html +++ b/docs/src/_templates/layout.html @@ -25,7 +25,7 @@ DEBUG: nav_version = {{ nav_version }}Warning
(rtd_version2) You a viewing the latest unreleased documentation From 0d54f020f0cb74c949c8c79a0d132ecda4914ed5 Mon Sep 17 00:00:00 2001 From: Tremain Knight <2108488+tkknight@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:55:19 +0000 Subject: [PATCH 09/21] removed line --- docs/src/_templates/layout.html | 20 -------------------- docs/src/conf.py | 1 - 2 files changed, 21 deletions(-) diff --git a/docs/src/_templates/layout.html b/docs/src/_templates/layout.html index b69d01d330..d49e013eb1 100644 --- a/docs/src/_templates/layout.html +++ b/docs/src/_templates/layout.html @@ -7,24 +7,6 @@ /*---------------------------------------------------------------------------*/ {%- block document %} -{% if theme_display_version %} -{%- set nav_version = version %} -{% if READTHEDOCS and current_version %} - {%- set nav_version = current_version %} -{% endif %} -{% if nav_version %} -
Warning
- (rtd_version2) You a viewing the latest unreleased documentation + You a viewing the latest unreleased documentation v{{ version }}. You may prefer a stable version. diff --git a/docs/src/conf.py b/docs/src/conf.py index ca13bc8687..b91dc2b764 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -134,30 +134,6 @@ def autolog(message): # TREMTEST # "generate_package_rst", ] - -# -- sphinx-version-warning extension------------------------------------------ -# See https://sphinx-version-warning.readthedocs.io/en/latest/index.html - -versionwarning_messages = { - "latest": ( - "(exntesion) You a viewing the latest unreleased documentation " - "v{{ version }}. You may prefer a " - "stable" - "version." - ), -} - -versionwarning_admonition_type = "tip" -# versionwarning_banner_title = "Tip" -# versionwarning_body_selector = 'div[itemprop="articleBody"]' - -# === -# Show warning at top of page -# versionwarning_body_selector = "div.document" -# versionwarning_banner_title = "" -# For debugging locally -versionwarning_project_version = "latest" - # -- panels extension --------------------------------------------------------- # See https://sphinx-panels.readthedocs.io/en/latest/ @@ -191,7 +167,7 @@ def autolog(message): # See https://sphinx-copybutton.readthedocs.io/en/latest/ copybutton_prompt_text = ">>> " -# sphinx.ext.todo configuration +# sphinx.ext.todo configuration ----------------------------------------------- # See https://www.sphinx-doc.org/en/master/usage/extensions/todo.html todo_include_todos = True From da2510f745b670451a36edf98b1c315a93e0fc0e Mon Sep 17 00:00:00 2001 From: Tremain Knight <2108488+tkknight@users.noreply.github.com> Date: Sun, 14 Feb 2021 18:19:05 +0000 Subject: [PATCH 11/21] tidy comments --- docs/src/_templates/layout.html | 1 - docs/src/conf.py | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/src/_templates/layout.html b/docs/src/_templates/layout.html index c67f4f8836..99ec1ad20e 100644 --- a/docs/src/_templates/layout.html +++ b/docs/src/_templates/layout.html @@ -14,7 +14,6 @@ v{{ version }}. You may prefer a stable version. -
Warning
From 153fa2c13a54064a417bf5d8fa9fc4cfea9861a0 Mon Sep 17 00:00:00 2001 From: Tremain Knight <2108488+tkknight@users.noreply.github.com> Date: Sun, 14 Feb 2021 18:42:51 +0000 Subject: [PATCH 13/21] added reminder --- docs/src/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/conf.py b/docs/src/conf.py index 1129ecb0e7..8fb54ea16e 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -44,6 +44,7 @@ def autolog(message): autolog("[READTHEDOCS] {} = {}".format(item, value)) # This is the rtd reference to the version, such as: latest, stable, v3.0.1 etc +# TREMTEST: I may not need to create a variable, see https://docs.readthedocs.io/en/stable/development/design/theme-context.html?highlight=html_ rtd_version = os.environ.get("READTHEDOCS_VERSION") # -- Path setup -------------------------------------------------------------- From adad28c8f3cc3ff60681219d7007bba2984b11ec Mon Sep 17 00:00:00 2001 From: Tremain Knight <2108488+tkknight@users.noreply.github.com> Date: Mon, 15 Feb 2021 10:18:30 +0000 Subject: [PATCH 14/21] testing --- docs/src/_templates/layout.html | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/src/_templates/layout.html b/docs/src/_templates/layout.html index 51b976f3f8..59a8356b4f 100644 --- a/docs/src/_templates/layout.html +++ b/docs/src/_templates/layout.html @@ -6,10 +6,20 @@ /*---------------------------------------------------------------------------*/ +{%- block sidebartitle %} + {{ super() }} + + FOO! +{%- endblock %} + +/*---------------------------------------------------------------------------*/ + {%- block document %} DEBUG: - readthedocs.v1.vcs.type = {{ readthedocs.v1.vcs.type }} - readthedocs.v1 = {{ readthedocs.v1 }} + {% if readthedocs %} + readthedocs.v1.vcs.type = {{ readthedocs.v1.vcs.type }} + readthedocs.v1 = {{ readthedocs.v1 }} + {%- endif %} {% if rtd_version == 'latest' %}Warning
+Warning
+ You a viewing the latest unreleased documentation + v{{ version }}. You may prefer a + stable + version. +Warning
- You a viewing the latest unreleased documentation + You are viewing the latest unreleased documentation v{{ version }}. You may prefer a stable version. From 14d9b128da238b3837f0e112515fade849db5cb6 Mon Sep 17 00:00:00 2001 From: tkknight <2108488+tkknight@users.noreply.github.com> Date: Fri, 19 Feb 2021 12:34:12 +0000 Subject: [PATCH 20/21] Update layout.html Remove alternative banner that used the RestructuredText notation. --- docs/src/_templates/layout.html | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/src/_templates/layout.html b/docs/src/_templates/layout.html index c60146b6d3..96a2e0913e 100644 --- a/docs/src/_templates/layout.html +++ b/docs/src/_templates/layout.html @@ -15,15 +15,6 @@ version.Warning
- You are viewing the latest unreleased documentation - v{{ version }}. You may prefer a - stable - version. -