Skip to content

Commit 0fc82e9

Browse files
authored
[2.7] Doc: Add an optional obsolete header. (pythonGH-19229)
1 parent 7a41638 commit 0fc82e9

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Doc/README.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ Then, from the ``Doc`` directory, run ::
104104
where ``<builder>`` is one of html, text, latex, or htmlhelp (for explanations
105105
see the make targets above).
106106

107+
Deprecation header
108+
==================
109+
110+
Following the sunsetting of Python 2.7, a red banner displays at the
111+
top of each page redirecting to the corresponding page on
112+
``https://docs.python.org/3/``.
113+
107114

108115
Contributing
109116
============

Doc/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
# Split the index
8181
html_split_index = True
8282

83+
html_context = {
84+
'outdated': True
85+
}
86+
8387

8488
# Options for LaTeX output
8589
# ------------------------

Doc/tools/templates/layout.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{% extends "!layout.html" %}
2+
{% block header %}
3+
{%- if outdated %}
4+
<div id="outdated-warning" style="padding: .5em; text-align: center; background-color: #FFBABA; color: #6A0E0E;">
5+
{% trans %}This document is for an old version of Python that is {% endtrans %}<a href="https://devguide.python.org/devcycle/#end-of-life-branches">{% trans %}no longer supported{% endtrans %}</a>.
6+
{% trans %}You should upgrade, and read the {% endtrans %}
7+
<a href="https://docs.python.org/{{ language + '/' if language and language != 'en' else '' }}3/{{ pagename }}{{ file_suffix }}">{% trans %} Python documentation for the current stable release{% endtrans %}</a>.
8+
</div>
9+
{%- endif %}
10+
{% endblock %}
11+
212
{% block rootrellink %}
313
<li><img src="{{ pathto('_static/py.png', 1) }}" alt=""
414
style="vertical-align: middle; margin-top: -1px"/></li>

0 commit comments

Comments
 (0)