home · contact · privacy
Add explanatory text to HTML view, inter-link HTML and TXT versions.
[berlin-corona-table] / enhance_table.py
index 66614c36433a9e64422fe1768ee11ef217624fde..03382554e2dbfc538aca8107777ed15ee789546c 100755 (executable)
@@ -131,16 +131,18 @@ for i in range(len(sorted_dates)):
 
 # Optimized for web browser viewing.
 if output_type == 'html':
-    print('<html>')
-    print('<style>')
-    print('table, tr, th, td { border: 1px solid black; }')
-    print('.day_row:nth-child(7n+2) { background-color: yellow; }')
-    print('.district_name { writing-mode: vertical-rl; '
-          'transform: rotate(180deg); }')
-    print('</style>')
-    print('<table>')
-    print('<tr>')
-    print('<th>date</th>')
+    print("""<html>
+<style>
+table, tr, th, td { border: 1px solid black; }
+.day_row:nth-child(7n+2) { background-color: yellow; }
+.district_name { writing-mode: vertical-rl; transform: rotate(180deg); }
+</style>
+<h1>Table of Berlin's Corona infection number development by districts.
+</h1>
+<p>Updated daily at 9pm. <a href="https://plomlompom.com/repos/?p=berlin-corona-table">Source code</a>. <a href="berlin_corona.txt">Text view optimized for terminal curl</a>.</p>
+<table>
+<tr>
+<th>date</th>""")
     sorted_dates.reverse()
     sum_district = sorted_districts[-1]
     for district in sorted_districts:
@@ -195,6 +197,8 @@ Abbrevations/explanations:
         intro += "%s: %s\n" % (k, translate[k])
     intro += """
 Source code: https://plomlompom.com/repos/?p=berlin-corona-table
+
+HTML view: https://plomlompom.com/berlin_corona.html
 """
     print(intro)