From 601ab994238dc43115be48f1c0ac0616ee7ad5f6 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 4 Jul 2020 02:25:24 +0200 Subject: [PATCH] Refactor symbol usage, add symbol explanation anchor to HTML. (The latter for mobile device views where abbreviations cannot be hovered productively.) --- enhance_table.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/enhance_table.py b/enhance_table.py index 07ad84b..62e5039 100755 --- a/enhance_table.py +++ b/enhance_table.py @@ -32,6 +32,7 @@ translate = { 'TS': 'Tempelhof-Schöneberg', 'TK': 'Treptow-Köpenick', 'sum': 'all of Berlin', + '+': 'new infections counted', 'Σ': 'sum of new infections for last 7 days', 'Ø': 'per-day average of new infections for last 7 days', 'i': 'incidence (x per 100k inhabitants) of new infections for last 7 days', @@ -154,24 +155,24 @@ th { text-align: left; vertical-align: bottom; } """) sorted_dates.reverse() for district in sorted_districts: - long_form = translate[district] # Wrap in div because the vertical orientation otherwise fails # in Chromium. - print('
%s
' % long_form) + print('
%s
' % + translate[district]) print('') print('') # In Chromium, the th only stay fixed if also given this class. print('date') - print('') + print('?') for district in sorted_districts: - print('%s' % district) + print('%s' % + (translate[district], district)) print('') for date in sorted_dates: print('') print('%s' % date) print('') - print('') - for abbr in ['Σ', 'Ø', 'i']: + for abbr in ['+', 'Σ', 'Ø', 'i']: print('' % (translate[abbr], abbr)) print('
+
%s
') @@ -195,6 +196,11 @@ th { text-align: left; vertical-align: bottom; } print('') print('') print('') + print('

Symbols

') + print('
') + for abbr in ['+', 'Σ', 'Ø', 'i']: + print('
%s
%s
' % (abbr, translate[abbr])) + print('
') print('') # Optimized for in-terminal curl. @@ -208,6 +214,8 @@ Updated daily at 9pm based on data from the "Senatsverwaltung für Gesundheit, P Abbrevations/explanations: """ for k in translate: + if k == '+': # not used in terminal version + continue intro += "%s: %s\n" % (k, translate[k]) intro += """ Source code: https://plomlompom.com/repos/?p=berlin-corona-table -- 2.30.2