home
·
contact
·
privacy
projects
/
berlin-corona-table
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
43820a0
)
Replace sticky header (and week-separator lines) with repeated header.
author
Christian Heller
<c.heller@plomlompom.de>
Sat, 4 Jul 2020 11:10:53 +0000
(13:10 +0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sat, 4 Jul 2020 11:10:53 +0000
(13:10 +0200)
enhance_table.py
patch
|
blob
|
history
diff --git
a/enhance_table.py
b/enhance_table.py
index 0ca53d7a200f5f5b4255fb85acaf3452dc4ff425..4a060a4b758a654ee5593662cf0f66386e037bf1 100755
(executable)
--- a/
enhance_table.py
+++ b/
enhance_table.py
@@
-140,9
+140,8
@@
if output_type == 'html':
<head>
<style>
th { text-align: left; vertical-align: bottom; }
<head>
<style>
th { text-align: left; vertical-align: bottom; }
-.day_row:nth-child(7n+3) > td { border-top: 1px solid black; }
.vertical_header { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: normal; }
.vertical_header { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: normal; }
-.
fixed_head { position: sticky; top: 0; background-color: white
; }
+.
repeated_head th { padding-top: 0.5em; border-bottom: 1px solid black
; }
.bold { font-weight: bold }
</style>
<title>Berlin's Corona infection numbers, development by districts</title>
.bold { font-weight: bold }
</style>
<title>Berlin's Corona infection numbers, development by districts</title>
@@
-160,15
+159,16
@@
th { text-align: left; vertical-align: bottom; }
print('<th><div class="vertical_header">%s</div></th>' %
translate[district])
print('</tr>')
print('<th><div class="vertical_header">%s</div></th>' %
translate[district])
print('</tr>')
- print('<tr class="fixed_head">')
- # In Chromium, the th only stay fixed if also given this class.
- print('<th class="fixed_head">date</th>')
- print('<th class="fixed_head"><a href="#symbols">?</a></th>')
- for district in sorted_districts:
- print('<th class="fixed_head"><abbr title="%s">%s</abbr></th>' %
- (translate[district], district))
- print('</tr>')
+ weekday_count = 0
for date in sorted_dates:
for date in sorted_dates:
+ if weekday_count == 0:
+ print('<tr class="repeated_head">')
+ print('<th>date</th>')
+ print('<th><a href="#symbols">?</a></th>')
+ for district in sorted_districts:
+ print('<th><abbr title="%s">%s</abbr></th>' %
+ (translate[district], district))
+ print('</tr>')
print('<tr class="day_row">')
print('<td>%s</td>' % date)
print('<td><table>')
print('<tr class="day_row">')
print('<td>%s</td>' % date)
print('<td><table>')
@@
-195,6
+195,10
@@
th { text-align: left; vertical-align: bottom; }
print('</table>')
print('</td>')
print('</tr>')
print('</table>')
print('</td>')
print('</tr>')
+ weekday_count += 1
+ if weekday_count != 7:
+ continue
+ weekday_count = 0
print('</table>')
print('<h3 id="symbols">Symbols</h3>')
print('<dl>')
print('</table>')
print('<h3 id="symbols">Symbols</h3>')
print('<dl>')