summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSviatoslav Sydorenko <wk@sydorenko.org.ua>2017-09-06 22:33:36 +0300
committerSviatoslav Sydorenko <wk@sydorenko.org.ua>2017-09-12 10:06:58 +0300
commit6b46e15b6e0f3b7eeed7b6ec06522cf2b92253ca (patch)
tree7b107fdfc482dad36d395f0b42fc2519474ef3a1
parent189eaf7e471ee2dd441e587ad7437035ab831aac (diff)
downloadcherrypy-git-6b46e15b6e0f3b7eeed7b6ec06522cf2b92253ca.tar.gz
Add Python 2 EOL top banner with countdown to docs
Inspired by kennethreitz/python-guide@7a58e5c
-rw-r--r--docs/_templates/python_2_eol.html49
-rw-r--r--docs/conf.py5
2 files changed, 53 insertions, 1 deletions
diff --git a/docs/_templates/python_2_eol.html b/docs/_templates/python_2_eol.html
new file mode 100644
index 00000000..21ae4333
--- /dev/null
+++ b/docs/_templates/python_2_eol.html
@@ -0,0 +1,49 @@
+<!-- Based on https://github.com/kennethreitz/python-guide/commit/7a58e5c03ab1a21f07367937454c966505ca8af7 -->
+<aside id="python27eol">
+ <a href="https://pythonclock.org/" target="_blank" title="Python 2.7 EOL Countdown">
+ Python 3, the new best practice, is here to stay.
+ Python 2 will retire in only <time></time>!
+ </a>
+</aside>
+
+<!-- Python 2 EOL Clock -->
+<style type="text/css">
+ body {
+ margin-top: 4em;
+ }
+
+ #python27eol {
+ position: fixed;
+ top: 0;
+ left: 0; right: 0;
+ height: auto;
+ text-align: center;
+ color: white;
+ background-color: black;
+ font-size: larger;
+ line-height: 3;
+ }
+
+ #python27eol>* {
+ color: white;
+ background-color: black;
+ }
+
+ #python27eol>a {
+ display: block;
+ }
+</style>
+
+<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
+<script src="//cdnjs.cloudflare.com/ajax/libs/countdown/2.6.0/countdown.min.js"></script>
+<script src="//cdn.rawgit.com/icambron/moment-countdown/master/dist/moment-countdown.min.js"></script>
+
+<script>
+ var py2_death = moment('2020-04-12').toDate()
+
+ countdown(py2_death, update_time_left)
+
+ function update_time_left(moments_left, timer_id) {
+ document.querySelector('#python27eol time').innerHTML = moments_left.toHTML("em")
+ }
+</script>
diff --git a/docs/conf.py b/docs/conf.py
index 6005ced9..dc34501f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -162,7 +162,10 @@ html_static_path = ['_static']
#html_use_smartypants = True # noqa
# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {} # noqa
+html_sidebars = {
+ 'index': 'python_2_eol.html',
+ '**': 'python_2_eol.html',
+}
# Additional templates that should be rendered to pages, maps page names to
# template names.