{#- Career-at-a-glance timeline, driven by `criteria.career` in data/criteria.yaml. Bands tile the full width left→right. Each band's share of the width is its `weight` (defaults to its duration in years), so you can stretch or compress a phase without touching the SVG. Ticks sit at band starts; milestone dots are interpolated by year within their band, so they always line up. -#} {%- set car = criteria.career -%} {%- set X0 = 15 -%}{%- set X1 = 705 -%}{%- set W = X1 - X0 -%} {%- set gap = car.band_gap | default(4) -%} {%- set fills = car.fills or ['#dbe7f4', '#aac6e4', '#4a86c8', '#0f3f73'] -%} {%- set strokes = car.strokes or ['#aac6e4', '#8fb2d8', '', ''] -%} {#- total weight, then per-band pixel segments -#} {%- set tn = namespace(t=0) -%} {%- for b in car.bands -%}{%- set tn.t = tn.t + (b.weight | default(b.end - b.start)) -%}{%- endfor -%} {%- set total = tn.t or 1 -%} {%- set ns = namespace(cum=0, segs=[]) -%} {%- for b in car.bands -%} {%- set s0 = X0 + (ns.cum / total) * W -%} {%- set ns.cum = ns.cum + (b.weight | default(b.end - b.start)) -%} {%- set s1 = X0 + (ns.cum / total) * W -%} {%- set _ = ns.segs.append({'b': b, 's0': s0, 's1': s1}) -%} {%- endfor -%} {%- macro px(year) -%} {%- for s in ns.segs if year >= s.b.start and year <= s.b.end -%} {%- if loop.first -%}{{ (s.s0 + (year - s.b.start) / ((s.b.end - s.b.start) or 1) * (s.s1 - s.s0)) | round(1) }}{%- endif -%} {%- else -%}{{ X1 }}{%- endfor -%} {%- endmacro -%}
{{ car.caption }}