# 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('</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>
+<table>
+<tr>
+<th>date</th>""")
+ sorted_dates.reverse()
+ sum_district = sorted_districts[-1]
for district in sorted_districts:
long_form = translate[district]
- print('<th style="writing-mode: vertical-rl; '
- 'transform: rotate(180deg);">%s</th>' % long_form)
+ if sum_district == district:
+ print('<th>%s</th>' % long_form)
+ else:
+ print('<th class="district_name">%s</th>' % long_form)
print('</tr>')
- sorted_dates.reverse()
- sum_district = sorted_districts[-1]
for date in sorted_dates:
print('<tr class="day_row">')
print('<td>%s</td>' % date)