-
Notifications
You must be signed in to change notification settings - Fork 11
/
v2h_templates.py
174 lines (166 loc) · 4.43 KB
/
v2h_templates.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# These are templates for validation_to_html.py
# Variables should be in curly braces
STYLE = '''
<style>
body {
font-family: sans-serif;
font-size: 12pt;
}
th {
font-size: 10pt;
}
.errors {
font-size: 10pt;
color: darkred;
margin-bottom: 1em;
}
.warnings {
font-size: 10pt;
color: darkblue;
margin-bottom: 1em;
}
.bold {
font-weight: bold;
}
.color0 {
background: pink;
}
.color1 {
background: lightgreen;
}
.hlink {
color: #888;
opacity: 0.5;
}
table {
max-width: 900px;
}
tr:hover td:nth-child(n+2) {
background: lightblue;
}
</style>
'''
INDEX_HEADER = '''
<!doctype html>
<html>
<head>
<title>Subway Validator</title>
<meta charset="utf-8">
(s)
</head>
<body>
<h1>Subway Validation Results</h1>
<p>Total good metro networks: {good_cities} of {total_cities}.</p>
<p><a href="render.html">View on the map</a></p>
<table cellspacing="3" cellpadding="2" style="margin-bottom: 1em;">
'''.replace('(s)', STYLE)
INDEX_CONTINENT = '''
<tr><td colspan="9"> </td></tr>
<tr>
<th>Continent</th>
<th>Country</th>
<th>Good Cities</th>
<th>Subway Lines</th>
<th>Light Rail Lines</th>
<th>Stations</th>
<th>Interchanges</th>
<th>Errors</th>
<th>Warnings</th>
</tr>
<tr>
<td colspan="2" class="bold color{=cities}">{continent}</td>
<td class="color{=cities}">{good_cities} / {total_cities}</td>
<td class="color{=subwayl}">{subwayl_found} / {subwayl_expected}</td>
<td class="color{=lightrl}">{lightrl_found} / {lightrl_expected}</td>
<td class="color{=stations}">{stations_found} / {stations_expected}</td>
<td class="color{=transfers}">{transfers_found} / {transfers_expected}</td>
<td class="color{=errors}">{num_errors}</td>
<td class="color{=warnings}">{num_warnings}</td>
</tr>
{content}
'''
INDEX_COUNTRY = '''
<tr>
<td> </td>
<td class="bold color{=cities}"><a href="{file}">{country}</a></td>
<td class="color{=cities}">{good_cities} / {total_cities}</td>
<td class="color{=subwayl}">{subwayl_found} / {subwayl_expected}</td>
<td class="color{=lightrl}">{lightrl_found} / {lightrl_expected}</td>
<td class="color{=stations}">{stations_found} / {stations_expected}</td>
<td class="color{=transfers}">{transfers_found} / {transfers_expected}</td>
<td class="color{=errors}">{num_errors}</td>
<td class="color{=warnings}">{num_warnings}</td>
</tr>
'''
INDEX_FOOTER = '''
</table>
<p>Produced by <a href="https://github.com/mapsme/subways">Subway Preprocessor</a> on {date}.
See <a href="{google}">this spreadsheet</a> for the reference metro statistics and
<a href="https://en.wikipedia.org/wiki/List_of_metro_systems#List">this wiki page</a> for a list
of all metro systems.</p>
</body>
</html>
'''
COUNTRY_HEADER = '''
<!doctype html>
<html>
<head>
<title>Subway Validator: {country}</title>
<meta charset="utf-8">
(s)
</head>
<body>
<h1>Subway Validation Results for {country}</h1>
<p><a href="index.html">Return to the countries list</a>.</p>
<table cellspacing="3" cellpadding="2">
<tr>
<th>City</th>
{?subways}
<th>Subway Lines</th>
<th>Light Rail Lines</th>
{end}{?overground}
<th>Tram Lines</th>
<th>Bus Lines</th>
<th>T-Bus Lines</th>
<th>Other Lines</th>
{end}
<th>Stations</th>
<th>Interchanges</th>
<th>Unused Entrances</th>
</tr>
'''.replace('(s)', STYLE)
COUNTRY_CITY = '''
<tr id="{slug}">
<td class="bold color{good_cities}">
{city}
{?yaml}<a href="{yaml}" class="hlink" title="Download YAML">Y</a>{end}
{?json}<a href="{json}" class="hlink" title="Download GeoJSON">J</a>{end}
{?json}<a href="render.html#{slug}" class="hlink" title="View map" target="_blank">M</a>{end}
</td>
{?subways}
<td class="color{=subwayl}">sub: {subwayl_found} / {subwayl_expected}</td>
<td class="color{=lightrl}">lr: {lightrl_found} / {lightrl_expected}</td>
{end}{?overground}
<td class="color{=traml}">t: {traml_found} / {traml_expected}</td>
<td class="color{=busl}">b: {busl_found} / {busl_expected}</td>
<td class="color{=trolleybusl}">tb: {trolleybusl_found} / {trolleybusl_expected}</td>
<td class="color{=otherl}">o: {otherl_found} / {otherl_expected}</td>
{end}
<td class="color{=stations}">st: {stations_found} / {stations_expected}</td>
<td class="color{=transfers}">int: {transfers_found} / {transfers_expected}</td>
<td class="color{=entrances}">e: {unused_entrances}</td>
</tr>
<tr><td colspan="{?subways}6{end}{?overground}8{end}">
<div class="errors">
{errors}
</div><div class="warnings">
{warnings}
</div>
</td></tr>
'''
COUNTRY_FOOTER = '''
</table>
<p>Produced by <a href="https://github.com/mapsme/subways">Subway Preprocessor</a> on {date}.</p>
</body>
</html>
'''