Make old-doc headers easily configurable

This commit is contained in:
Griatch 2023-06-10 10:46:30 +02:00
parent 0310eb16bb
commit 371fe32662
2 changed files with 21 additions and 11 deletions

View file

@ -169,22 +169,19 @@
{%- block body_tag %}<body>{% endblock %}
{%- block header %}
{% if current_is_legacy %}
<div class="admonition important">
<p class="first admonition-title">Note</p>
<p class="last">You are reading an old version of the Evennia documentation. <a href="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.
</div>
{% endif %}
{% endblock %}
{%- block relbar1 %}{{ relbar() }}{% endblock %}
{%- block content %}
{% if legacy_versions %}
{% if release in legacy_versions %}
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You are reading an old version of this documentation.</p>
</div>
{% endif %}
{% endif %}
{%- block sidebar1 %} {# possible location for sidebar #} {% endblock %}
<div class="document">
@ -210,7 +207,16 @@
{%- block relbar2 %}{{ relbar() }}{% endblock %}
{%- block footer %}
{% if current_is_legacy %}
<div class="admonition important">
<p class="first admonition-title">Note</p>
<p class="last">You are reading an old version of the Evennia documentation. <a href="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.
</div>
{% endif %}
<div class="footer" role="contentinfo">
{%- if show_copyright %}
{%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}

View file

@ -22,7 +22,6 @@ author = "The Evennia developer community"
# This will be used for multi-version selection options.
release = "2.x"
# -- General configuration ---------------------------------------------------
extensions = [
@ -68,11 +67,16 @@ legacy_versions = ["1.3.0", "0.9.5"]
def add_legacy_versions_to_html_page_context(app, pagename, templatename, context, doctree):
# this is read by versioning.html template (sidebar)
# set this when building legacy docs, to show the 'you are reading an old version' headers
current_is_legacy = False
LVersion = namedtuple("legacy_version", ["release", "name", "url"])
context["legacy_versions"] = [
LVersion(release=f"{vers}", name=f"v{vers}", url=f"../{vers}/index.html")
for vers in legacy_versions
]
context["current_is_legacy"] = current_is_legacy
# -- Options for HTML output -------------------------------------------------