From acffb1b7eb69bffe1dbd9d1a1ad86f719b972330 Mon Sep 17 00:00:00 2001 From: Tremain Knight <2108488+tkknight@users.noreply.github.com> Date: Wed, 20 Sep 2023 16:24:58 +0100 Subject: [PATCH] moved latest warning banner logic to conf.py --- docs/src/_templates/layout.html | 20 -------------------- docs/src/conf.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 20 deletions(-) delete mode 100644 docs/src/_templates/layout.html diff --git a/docs/src/_templates/layout.html b/docs/src/_templates/layout.html deleted file mode 100644 index 974bd12753..0000000000 --- a/docs/src/_templates/layout.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "pydata_sphinx_theme/layout.html" %} - -{# This uses blocks. See: - https://www.sphinx-doc.org/en/master/templating.html -#} - - - {%- block docs_body %} - - {% if on_rtd and rtd_version == 'latest' %} -
- - {%- endif %} - - {{ super() }} -{%- endblock %} diff --git a/docs/src/conf.py b/docs/src/conf.py index 7f7322c1f8..5b3fd9433b 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -329,6 +329,16 @@ def _dotv(version): }, } +# if we are building via Read The Docs and it is the latest (not stable) +if on_rtd and rtd_version == "latest": + html_theme_options[ + "announcement" + ] = f""" + You are viewing the latest unreleased documentation + {version}. You can switch to a + stable + version.""" + rev_parse = run(["git", "rev-parse", "--short", "HEAD"], capture_output=True) commit_sha = rev_parse.stdout.decode().strip()