-
-
Notifications
You must be signed in to change notification settings - Fork 977
Expand file tree
/
Copy pathrelease_cycle_template.svg.jinja
More file actions
317 lines (298 loc) · 11.1 KB
/
release_cycle_template.svg.jinja
File metadata and controls
317 lines (298 loc) · 11.1 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns="http://www.w3.org/2000/svg"
class="release-cycle-chart"
viewBox="0 0 {{ diagram_width }} {{ diagram_height }}"
>
<style>
/* Embedded styles for standalone viewing */
.release-cycle-chart {
color-scheme: light;
{# Copy vars from Furo theme if present #}
{% for varname, default in {
'color-foreground-primary': 'light-dark(#333, #fff)',
'color-background-primary': 'light-dark(#fff, #333)',
'color-brand-primary': '#4B8BBE',
'color-background-item': '#e0e0e0',
}.items() %}
--svg-{{varname}}: var(--{{varname}}, {{default}});
{% endfor %}
font-family: var(
--font-stack,
-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica,
Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji);
width: 100%;
--blob-border-width: 1.6px;
--status-bg-color: #CCC;
--status-border-color: #888;
}
.background {
fill: var(--svg-color-background-primary);
}
.release-cycle-year-line {
stroke: var(--svg-color-foreground-primary);
stroke-width: 0.8px;
opacity: 75%;
}
.release-cycle-today-line {
stroke: var(--svg-color-brand-primary);
stroke-width: var(--blob-border-width);
}
.release-cycle-row-shade {
fill: var(--svg-color-background-item);
opacity: 50%;
}
.release-cycle-blob {
stroke-width: var(--blob-border-width);
}
.text-main {
fill: var(--svg-color-foreground-primary);
/* use specific colours on known backgrounds */
&.release-cycle-status-security,
&.release-cycle-status-bugfix {
fill: black;
}
}
.text-outline {
/* an outline of the background color, in case it's not set
correctly */
fill: transparent;
stroke: var(--svg-color-background-primary);
stroke-width: var(--blob-border-width);
/* use specific colours on known backgrounds */
&.release-cycle-status-security,
&.release-cycle-status-bugfix {
stroke: var(--status-bg-color);
}
}
.release-cycle-status-end-of-life {
--status-bg-color: #DD2200;
--status-border-color: #FF8888;
}
.release-cycle-status-security {
--status-bg-color: #FFDD44;
--status-border-color: #FF8800;
}
.release-cycle-status-bugfix {
--status-bg-color: #00DD22;
--status-border-color: #008844;
}
.release-cycle-status-prerelease {
--status-bg-color: teal;
--status-border-color: darkgreen;
}
.release-cycle-status-feature {
--status-bg-color: #2222EE;
--status-border-color: #008888;
}
.release-cycle-status-planned {
/* Use grey defaults */
}
.release-cycle-blob {
fill: var(--status-bg-color);
stroke: transparent;
}
.release-cycle-blob-full {
fill: var(--status-bg-color);
stroke: var(--status-border-color);
}
.release-cycle-border {
fill: transparent;
stroke: var(--status-border-color);
stroke-width: var(--blob-border-width);
}
</style>
<defs>
<linearGradient id="release-cycle-mask-gradient-{{ id_key }}">
<stop stop-color="black" offset="0%" />
<stop stop-color="white" offset="100%" />
</linearGradient>
</defs>
<rect
class="background"
x="0"
y="0"
width="{{ diagram_width }}"
height="{{ diagram_height }}"
/>
{% for version in versions %}
{% set y = version.y * line_height %}
{% if version.y % 2 %}
<!-- Row shading -->
<rect
class="release-cycle-row-shade"
x="0em"
y="{{ y - 1.125 * SCALE }}"
width="{{ diagram_width }}"
height="{{ line_height }}"
/>
{% endif %}
{% endfor %}
{% for year in years %}
<text
class="release-cycle-year-text text-main"
x="{{ (year_to_x(year) + year_to_x(year + 1)) / 2 }}"
y="{{ diagram_height - line_height }}"
font-size="{{ SCALE * 0.75 }}"
text-anchor="middle"
>
{{ format_year(year) }}
</text>
{% if not loop.last %}
<line
class="release-cycle-year-line"
x1="{{ year_to_x(year + 1) }}"
x2="{{ year_to_x(year + 1) }}"
y1="0"
y2="{{ diagram_height - line_height }}"
font-size="{{ SCALE }}"
/>
{% endif %}
{% endfor %}
<!-- Gradient mask to fade out end-of-life versions -->
<mask id="release-cycle-mask-{{ id_key }}">
<rect
x="0"
y="0"
width="{{ legend_width }}"
height="{{ diagram_height }}"
fill="black"
/>
<rect
x="{{ legend_width - right_margin }}"
y="0"
width="{{ right_margin }}"
height="{{ diagram_height }}"
fill="url(#release-cycle-mask-gradient-{{ id_key }})"
/>
<rect
x="{{ legend_width }}"
y="0"
width="{{ diagram_width }}"
height="{{ diagram_height }}"
fill="white"
/>
</mask>
{% for version in versions %}
<!-- Colourful blob. -->
{% set top_y = version.y * line_height - 1 * SCALE %}
{% set height = 1.25 * SCALE %}
{% set start_x = date_to_x(version.first_release_date) %}
{% set end_x = date_to_x(version.end_of_life_date) %}
{% set radius = 0.25 * SCALE %}
<!-- bugfix/security blobs need to be split between the two phases.
Draw the rectangle with two path elements instead.
Thanks Claude.ai for the initial conversion.
-->
{% set middle_x = ([end_x, date_to_x(version.start_security_date)]|min) %}
{% set left_width = (middle_x - start_x) %}
{% set right_width = (end_x - middle_x) %}
{% if version.status != "end-of-life" %}
<!-- Split the blob using path operations
(Move-to, Vertical/Horizontal, Arc, Z=close shape;
lowercase means relative to the last point.)
We start drawing from the top of the straight boundary
between the half-blobs.
-->
<path
class="release-cycle-blob release-cycle-status-bugfix"
d="
M{{ middle_x }},{{ top_y }} {#- start -#}
v{{ height }} {#- down -#}
H{{ start_x + radius }} {#- left -#}
a{{ radius }},{{ radius }} 90 0 1 {#- rounded corner -#}
{{ -radius }} {{ -radius }}
v{{ -height + 2*radius }} {#- up -#}
a{{ radius }},{{ radius }} 90 0 1 {#- rounded corner -#}
{{ radius }} {{ -radius }}
Z {#- right -#}
"
/>
<path
class="release-cycle-blob release-cycle-status-security"
d="
M{{ middle_x }},{{ top_y }} {#- start -#}
v{{ height }} {#- down -#}
H{{ end_x - radius }} {#- right -#}
a{{ radius }},{{ radius }} 90 0 0 {#- rounded corner -#}
{{ radius }} {{ -radius }}
v{{ -height + 2*radius }} {#- up -#}
a{{ radius }},{{ radius }} 90 0 0 {#- rounded corner -#}
{{ -radius }} {{ -radius }}
Z {#- left -#}
"
/>
<!-- Add a common border -->
<rect
class="release-cycle-border release-cycle-status-{{ version.status }}"
x="{{ start_x }}"
y="{{ top_y }}"
width="{{ (end_x - start_x) }}"
height="{{ height }}"
rx="{{ radius }}"
ry="{{ radius }}"
/>
{% else %}
<!-- For EOL releases, use a single rounded rectangle -->
<rect
class="release-cycle-blob release-cycle-blob-full
release-cycle-status-{{ version.status }}"
x="{{ start_x }}"
y="{{ top_y }}"
width="{{ (end_x - start_x) }}"
height="{{ height }}"
rx="{{ radius }}"
ry="{{ radius }}"
mask="url(#release-cycle-mask-{{ id_key }})"
/>
{% endif %}
{% endfor %}
<!-- A line for today -->
<line
class="release-cycle-today-line"
x1="{{ date_to_x(today) }}"
x2="{{ date_to_x(today) }}"
y1="0"
y2="{{ diagram_height - line_height }}"
font-size="{{ SCALE }}"
/>
{% for version in versions %}
<!-- Label for colourful blob -->
{% set start_x = date_to_x(version.first_release_date) %}
{% set end_x = date_to_x(version.end_of_life_date) %}
{% set middle_x = ([end_x, date_to_x(version.start_security_date)]|min) %}
{% set small_text_y = version.y * line_height - 0.1 * SCALE %}
<!-- Add text before/after/inside the blob -->
{% for cls in ('text-outline', 'text-main') %}
<text
class="release-cycle-blob-label {{cls}} release-cycle-status-{{ version.status }}"
font-size="{{ SCALE * 0.75 }}"
y="{{ small_text_y }}"
{% if version.status == "bugfix" %}
x="{{ (start_x + middle_x) / 2 }}"
text-anchor="middle"
{% elif version.status == "security" %}
x="{{ (middle_x + end_x) / 2 }}"
text-anchor="middle"
{% elif version.status == "end-of-life" %}
x="{{ end_x + (0.25 * SCALE) }}"
text-anchor="start"
{% else %}
x="{{ start_x - (0.25 * SCALE) }}"
text-anchor="end"
{% endif %}
>
{{ version.status }}
</text>
{% endfor %}
<!-- Legend on the left -->
<text
class="release-cycle-version-label text-main"
x="{{ 0.5 * SCALE }}"
y="{{ version.y * line_height }}"
font-size="{{ SCALE }}"
>
Python {{ version.key }}
</text>
{% endfor %}
</svg>