aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@users.noreply.github.com>2020-04-18 18:55:10 -0400
committerGitHub <noreply@github.com>2020-04-18 17:55:10 -0500
commit0fc82e95878234291f23155a64408fced71892b2 (patch)
tree3245d03aca7d3b3f0c550159733d652c79f467bb
parentBump version to 2.7.18rc1. (diff)
downloadcpython-0fc82e95878234291f23155a64408fced71892b2.tar.gz
cpython-0fc82e95878234291f23155a64408fced71892b2.tar.bz2
cpython-0fc82e95878234291f23155a64408fced71892b2.zip
[2.7] Doc: Add an optional obsolete header. (GH-19229)
-rw-r--r--Doc/README.txt7
-rw-r--r--Doc/conf.py4
-rw-r--r--Doc/tools/templates/layout.html10
3 files changed, 21 insertions, 0 deletions
diff --git a/Doc/README.txt b/Doc/README.txt
index a362ecca942..625efd47532 100644
--- a/Doc/README.txt
+++ b/Doc/README.txt
@@ -104,6 +104,13 @@ Then, from the ``Doc`` directory, run ::
where ``<builder>`` is one of html, text, latex, or htmlhelp (for explanations
see the make targets above).
+Deprecation header
+==================
+
+Following the sunsetting of Python 2.7, a red banner displays at the
+top of each page redirecting to the corresponding page on
+``https://docs.python.org/3/``.
+
Contributing
============
diff --git a/Doc/conf.py b/Doc/conf.py
index 393018d08f5..29927c3bbbb 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -80,6 +80,10 @@ htmlhelp_basename = 'python' + release.replace('.', '')
# Split the index
html_split_index = True
+html_context = {
+ 'outdated': True
+}
+
# Options for LaTeX output
# ------------------------
diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index 8d6d3e5bd11..dbbfdeae2aa 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -1,4 +1,14 @@
{% extends "!layout.html" %}
+{% block header %}
+{%- if outdated %}
+<div id="outdated-warning" style="padding: .5em; text-align: center; background-color: #FFBABA; color: #6A0E0E;">
+ {% 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>.
+ {% trans %}You should upgrade, and read the {% endtrans %}
+ <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>.
+</div>
+{%- endif %}
+{% endblock %}
+
{% block rootrellink %}
<li><img src="{{ pathto('_static/py.png', 1) }}" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>