Sun, 07 Jan 2018 00:56:15 +0200
fix parsing
78 | 1 | {% from "macros.html" import route_rep %} |
2 | <html> | |
3 | <head> | |
4 | <link rel="icon" type="image/png" href="../static/favicon.png" /> | |
5 | <link rel="stylesheet" type="text/css" href="../static/style.css" /> | |
6 | <meta charset='UTF-8' /> | |
7 | <title>{{name}}</title> | |
8 | <style> | |
9 | .minute-time | |
10 | { | |
11 | font-weight: bold; | |
12 | } | |
13 | ||
14 | td.minute-time | |
15 | { | |
16 | width: 20pt; | |
17 | text-align: right; | |
18 | border-left: 1px solid gray; | |
19 | } | |
20 | ||
21 | td.minute-route | |
22 | { | |
23 | width: 0; | |
24 | margin: 0; | |
25 | padding-left: 0; | |
26 | padding-right: 3pt; | |
27 | text-align: left; | |
28 | } | |
29 | .minute-route span | |
30 | { | |
31 | font-size: 75%; | |
32 | } | |
33 | ||
34 | .hour-column | |
35 | { | |
36 | width: 20pt; | |
37 | } | |
38 | ||
39 | /* | |
40 | * Working days | |
41 | */ | |
42 | tr.working-day td.minute-time | |
43 | { | |
44 | border-left: 1px solid #0f2e4d; | |
45 | } | |
46 | ||
47 | .aikataulu tr.working-day td, .aikataulu tr.working-day th | |
48 | { | |
49 | border-top: 1px solid #0f2e4d; | |
50 | } | |
51 | ||
52 | .aikataulu tr.working-day | |
53 | { | |
54 | background-color: #adcae6; | |
55 | } | |
56 | ||
57 | .aikataulu tbody tr.working-day:nth-child(even) | |
58 | { | |
59 | background-color: #8fa7bf; | |
60 | } | |
61 | ||
62 | .aikataulu tr.working-day.night | |
63 | { | |
64 | background-color: #1f2933; | |
65 | color: white; | |
66 | } | |
67 | ||
68 | .aikataulu tbody tr.working-day.night:nth-child(even) | |
69 | { | |
70 | background-color: #2f3e4d; | |
71 | color: white; | |
72 | } | |
73 | ||
74 | /* | |
75 | * Satuday | |
76 | */ | |
77 | tr.saturday td.minute-time | |
78 | { | |
79 | border-left: 1px solid #194d0f; | |
80 | } | |
81 | ||
82 | .aikataulu tr.saturday td, .aikataulu tr.saturday th | |
83 | { | |
84 | border-top: 1px solid #194d0f; | |
85 | } | |
86 | ||
87 | .aikataulu tr.saturday | |
88 | { | |
89 | background-color: #b6e6ad; | |
90 | } | |
91 | ||
92 | .aikataulu tbody tr.saturday:nth-child(even) | |
93 | { | |
94 | background-color: #97bf8f; | |
95 | } | |
96 | ||
97 | .aikataulu tr.saturday.night | |
98 | { | |
99 | background-color: #30402d; | |
100 | color: white; | |
101 | } | |
102 | ||
103 | .aikataulu tbody tr.saturday.night:nth-child(even) | |
104 | { | |
105 | background-color: #4c6647; | |
106 | color: white; | |
107 | } | |
108 | ||
109 | /* | |
110 | * Sunday | |
111 | */ | |
112 | tr.sunday td.minute-time | |
113 | { | |
114 | border-left: 1px solid #4d132d; | |
115 | } | |
116 | ||
117 | .aikataulu tr.sunday td, .aikataulu tr.sunday th | |
118 | { | |
119 | border-top: 1px solid #4d132d; | |
120 | } | |
121 | ||
122 | .aikataulu tr.sunday | |
123 | { | |
124 | background-color: #e68ab8; | |
125 | } | |
126 | ||
127 | .aikataulu tbody tr.sunday:nth-child(even) | |
128 | { | |
129 | background-color: #bf7399; | |
130 | } | |
131 | ||
132 | .aikataulu tr.sunday.night | |
133 | { | |
134 | background-color: #4d2e3d; | |
135 | color: white; | |
136 | } | |
137 | ||
138 | .aikataulu tbody tr.sunday.night:nth-child(even) | |
139 | { | |
140 | background-color: #331f29; | |
141 | color: white; | |
142 | } | |
143 | </style> | |
144 | </head> | |
145 | {% macro night_class(hour) %} | |
146 | {% if hour < 5 or hour >= 23 %} | |
147 | night | |
148 | {% endif %} | |
149 | {% endmacro %} | |
150 | <body> | |
151 | <table class='aikataulu' cellspacing="0"> | |
152 | <thead> | |
153 | <tr> | |
154 | <th colspan='100' class='primary-heading'> | |
155 | <span><img src="../static/pysäkki.png" height="96" /> {{ref}} {{name}}</span> | |
156 | </th> | |
157 | </tr> | |
158 | </thead> | |
159 | <tbody> | |
160 | {% for day in week %} | |
161 | <tr class='{{day["day-class"]}}'> | |
162 | <th colspan='100'>{{day['day'].strftime('%a %e.%m.')}}</th> | |
163 | </tr> | |
164 | {% for hour, hour_schedule in day['schedule'].items() %} | |
165 | <tr class='{{day["day-class"]}} {{night_class(hour)}}'> | |
166 | <th class='hour-column {{night_class(hour)}}'>{{hour}}</th> | |
167 | {% for entry in hour_schedule %} | |
168 | <td class='minute-time'><span>{{'%02d' % entry['minute']}}</span></td> | |
169 | <td class='minute-route'><span>{{entry['route']}}</span></td> | |
170 | {% endfor %} | |
171 | </tr> | |
172 | {% endfor %} | |
173 | {% endfor %} | |
174 | </tbody> | |
175 | </table> | |
176 | </body> | |
177 | </html> |