From 0fc82e95878234291f23155a64408fced71892b2 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sat, 18 Apr 2020 18:55:10 -0400 Subject: [2.7] Doc: Add an optional obsolete header. (GH-19229) --- Doc/README.txt | 7 +++++++ Doc/conf.py | 4 ++++ Doc/tools/templates/layout.html | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/Doc/README.txt b/Doc/README.txt index a362ecc..625efd4 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 393018d..29927c3 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 8d6d3e5..dbbfdea 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 %}
  • -- cgit v0.12