docs: Add banner for 'latest' version

This commit is contained in:
patrick96 2023-10-22 21:21:16 +02:00 committed by Patrick Ziegler
parent 80aa2bade5
commit 054b9f4d33
2 changed files with 30 additions and 0 deletions

26
doc/_templates/layout.html vendored Normal file
View File

@ -0,0 +1,26 @@
{% extends "!layout.html" -%}
{# Refer to https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html #}
{%- block document %}
{#
Adds a warning message on the 'latest' version.
The warning is only added on readthedocs, if the version is 'latest'.
For the 'dev' folder, no warning is shown since the 'latest' version is
usually the most up-to-date.
#}
{% if READTHEDOCS and polybar_is_latest and not pagename.startswith('dev/') %}
<div class="admonition important">
<p class="admonition-title">Development Version</p>
<p>
This is the <code class="docutils literal notranslate"><span class="pre">latest</span></code>
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of polybar.
</p>
<p>
See the <a href="https://polybar.readthedocs.io/{{ pagename }}.html">stable version</a> of this documentation page instead.
</p>
</div>
{% endif %}
{{ super() }}
{%- endblock %}

View File

@ -149,6 +149,10 @@ extlinks_detect_hardcoded_links = True
# #
html_theme_options = {} html_theme_options = {}
html_context = {
'polybar_is_latest': version == 'latest',
}
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
# #