From: Leonard Richardson Date: Sat, 18 Apr 2020 22:55:10 +0000 (-0400) Subject: [2.7] Doc: Add an optional obsolete header. (GH-19229) X-Git-Tag: v2.7.18~3 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=0fc82e95878234291f23155a64408fced71892b2;p=thirdparty%2FPython%2Fcpython.git [2.7] Doc: Add an optional obsolete header. (GH-19229) --- diff --git a/Doc/README.txt b/Doc/README.txt index a362ecca9427..625efd47532b 100644 --- a/Doc/README.txt +++ b/Doc/README.txt @@ -104,6 +104,13 @@ Then, from the ``Doc`` directory, run :: where ```` 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 393018d08f51..29927c3bbbb8 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 8d6d3e5bd119..dbbfdeae2aa2 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -1,4 +1,14 @@ {% extends "!layout.html" %} +{% block header %} +{%- if outdated %} +
+ {% trans %}This document is for an old version of Python that is {% endtrans %}{% trans %}no longer supported{% endtrans %}. + {% trans %}You should upgrade, and read the {% endtrans %} + {% trans %} Python documentation for the current stable release{% endtrans %}. +
+{%- endif %} +{% endblock %} + {% block rootrellink %}