main
html 66 lines 3.69 KB
Raw
1 {{- /*
2 Generated cover card — a locally-rendered, deterministic header visual for
3 weekly articles. No third-party or hotlinked imagery.
4
5 Data-anchored topic chart (issue #560): every bar IS a topic. Bars and topic
6 labels share one element, in the same order, so each topic maps 1:1 to its bar
7 (no more decorative bars that outnumber/misalign the topics). Bar height and the
8 printed number encode the topic's EDITORIAL-PROMINENCE RANK — the order the
9 weekly analysis emits its `tags`, lead topic first (1 = lead topic). This is a
10 real, disclosed ordering signal, not a fabricated per-topic magnitude, so it
11 preserves the evidence-first editorial stance. A caption legend states exactly
12 what the bars measure, and bars carry distinct tonal shading.
13
14 Params (dict):
15 page : the page context (required)
16 */ -}}
17 {{- $page := .page -}}
18 {{- $week := $page.Params.week | default "" -}}
19 {{- $topics := $page.Params.tags | default slice -}}
20 {{- $topicCount := len $topics -}}
21 {{- $repos := $page.Params.repos_featured -}}
22 {{- $kicker := cond (ne $week "") (printf "Weekly signal · %s" $week) "Weekly signal" -}}
23
24 {{- /* Show at most 12 topics as bars so labels stay legible; any remainder is
25 disclosed as a "+N more" note rather than silently dropped. */ -}}
26 {{- $shown := $topics -}}
27 {{- if gt $topicCount 12 }}{{ $shown = first 12 $topics }}{{ end -}}
28 {{- $n := len $shown -}}
29
30 {{- /* Build an accessible summary from REAL data only. */ -}}
31 {{- $summaryParts := slice -}}
32 {{- if ne $week "" }}{{ $summaryParts = $summaryParts | append (printf "%s weekly report" $week) }}{{ else }}{{ $summaryParts = $summaryParts | append "Weekly report" }}{{ end -}}
33 {{- if gt $topicCount 0 }}{{ $summaryParts = $summaryParts | append (printf "tracking %d topic clusters, ordered by editorial prominence" $topicCount) }}{{ end -}}
34 {{- if $repos }}{{ $summaryParts = $summaryParts | append (printf "across %s featured repositories" (lang.FormatNumber 0 $repos)) }}{{ end -}}
35 {{- $summary := printf "Generated cover: %s." (delimit $summaryParts ", ") -}}
36
37 <figure class="article-cover article-cover--generated" aria-label="{{ $summary }}">
38 <div class="article-cover__panel">
39 <div class="article-cover__meta">
40 <p class="article-cover__kicker">{{ $kicker }}</p>
41 <p class="article-cover__brand">Claracle</p>
42 </div>
43 {{- if gt $topicCount 0 }}
44 {{- /* Topic titles are descriptive caption metadata, NOT controls. Render them
45 as plain, non-interactive labels — no link, no button/pill affordance —
46 so they never look clickable (operator ask, #328). The ordered list
47 conveys rank to assistive tech; the printed number is the visible echo. */ -}}
48 <ol class="article-cover__topics" aria-label="Topic clusters tracked this week, ordered by editorial prominence (1 = lead topic)">
49 {{- range $i, $t := $shown }}
50 {{- $rank := add $i 1 -}}
51 {{- /* Height = rank: lead topic full height, descending to the last topic. */ -}}
52 {{- $hpct := printf "%.0f" (math.Round (div (mul (sub $n $i) 100.0) $n)) -}}
53 <li class="article-cover__topic" style="--bar-h:{{ $hpct }}%;--bar-i:{{ $i }};">
54 <span class="article-cover__bar-num" aria-hidden="true">{{ $rank }}</span>
55 <span class="article-cover__bar" aria-hidden="true"></span>
56 <span class="article-cover__topic-label" title="{{ $t }}">{{ $t }}</span>
57 </li>
58 {{- end }}
59 </ol>
60 <p class="article-cover__legend">
61 Each bar is one of this week's {{ $topicCount }} topic clusters, ordered by editorial prominence (1&nbsp;=&nbsp;lead topic).
62 {{- if gt $topicCount $n }} Showing the top {{ $n }}; +{{ sub $topicCount $n }} more not charted.{{ end }}
63 </p>
64 {{- end }}
65 </div>
66 </figure>