Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

site: past contributors and a historians and sensitivity reviewers section (refs #416) (#430)

Eyal Golanbc67247b957e
diff --git a/site/scripts/check-site.mjs b/site/scripts/check-site.mjs
index 5891bc445..dceeb6682 100644
--- a/site/scripts/check-site.mjs
+++ b/site/scripts/check-site.mjs
@@ -6,10 +6,14 @@
// photograph), except contributor photos, which are portraits supplied by the owner;
// 4. nothing loads from another origin: no external script, stylesheet, font, image, video or frame;
// 5. every file under _astro/ that a page names exists;
-// 6. both devlog RSS feeds exist, are well-formed, list every post, and the devlog page links to them.
+// 6. both devlog RSS feeds exist, are well-formed, list every post, and the devlog page links to them;
+// 7. the contributors page puts each person from contributors.yaml in their group (team, historians and sensitivity
+// reviewers, past contributors, with years), and leaves out a group with no one in it. SITE_CONTRIBUTORS, as in
+// the build, points at a fixture instead (site/scripts/fixtures/contributors.yaml has one of each).
// Run after `astro build` (npm run build does both). Exit 1 with one line per problem.
import fs from 'node:fs';
import path from 'node:path';
+import YAML from 'yaml';
const dist = path.resolve(process.argv[2] ?? 'dist');
const problems = [];
@@ -136,6 +140,29 @@ for (const lang of ['en', 'he']) {
if (!/<main[\s\S]*<a href="[^"]*\/devlog\/rss\.xml"[\s\S]*<\/main>/.test(html)) fail(page, 'no link to the RSS feed');
}
+// 7. The contributors page: everyone in the right group, no empty group, years on every past entry.
+{
+ const file = path.resolve(import.meta.dirname, '../..', process.env.SITE_CONTRIBUTORS || 'site/src/data/contributors.yaml');
+ const people = YAML.parse(fs.readFileSync(file, 'utf8')).people ?? [];
+ const group = (p) => (p.until != null && p.until !== '' ? 'past' : (p.category ?? 'team') === 'team' ? 'team' : 'reviewers');
+ for (const lang of ['en', 'he']) {
+ const f = path.join(dist, lang, 'contributors', 'index.html');
+ if (!fs.existsSync(f)) { problems.push(`${lang}/contributors/: missing`); continue; }
+ const html = fs.readFileSync(f, 'utf8');
+ for (const g of ['team', 'reviewers', 'past']) {
+ const want = people.filter((p) => group(p) === g).map((p) => p.github).sort();
+ const at = html.indexOf(`data-people="${g}"`);
+ if (!want.length) { if (at >= 0) fail(f, `shows an empty ${g} section`); continue; }
+ if (at < 0) { fail(f, `no ${g} section for ${want.join(', ')}`); continue; }
+ const section = html.slice(at, html.indexOf('</section>', at));
+ const got = [...section.matchAll(/class="gh"[^>]*>@([^<]+)</g)].map((m) => m[1]).sort();
+ if (got.join() !== want.join()) fail(f, `${g} section lists ${got.join(', ') || 'no one'}, expected ${want.join(', ')}`);
+ if (g !== 'team' && !/<h2[^>]*>[^<]+<\/h2>/.test(section)) fail(f, `${g} section has no heading`);
+ if (g === 'past' && (section.match(/class="tenure"/g) ?? []).length !== want.length) fail(f, 'a past contributor without years');
+ }
+ }
+}
+
if (problems.length) {
console.error(problems.join('\n'));
console.error(`check-site: ${problems.length} problem(s)`);
diff --git a/site/scripts/fixtures/contributors.yaml b/site/scripts/fixtures/contributors.yaml
new file mode 100644
index 000000000..4145cf8dd
--- /dev/null
+++ b/site/scripts/fixtures/contributors.yaml
@@ -0,0 +1,31 @@
+# A test fixture, not a list of people. It exercises every group on the contributors page:
+# SITE_CONTRIBUTORS=site/scripts/fixtures/contributors.yaml npm run build
+# The handles are placeholders; nothing here is published.
+people:
+ - github: fixture-team
+ name: {}
+ title: { en: Fixture team entry, he: רשומת בדיקה של הצוות }
+ since: 2025
+
+ - github: fixture-historian
+ name: { en: Fixture Historian }
+ title: { en: Fixture historian entry, he: רשומת בדיקה של ייעוץ היסטורי }
+ category: historian
+
+ - github: fixture-reviewer
+ name: {}
+ title: { en: Fixture reviewer entry, he: רשומת בדיקה של בדיקת רגישות }
+ category: sensitivity-reviewer
+ since: "2026-03"
+
+ - github: fixture-past
+ name: {}
+ title: { en: Fixture past entry, he: רשומת בדיקה לשעבר }
+ since: "2024-11"
+ until: "2026-02"
+
+ - github: fixture-past-historian
+ name: {}
+ title: { en: Fixture past historian entry, he: רשומת בדיקה של ייעוץ היסטורי לשעבר }
+ category: historian
+ until: 2025
diff --git a/site/src/data/contributors.yaml b/site/src/data/contributors.yaml
index c58eadd7c..9bb1bd6a3 100644
--- a/site/src/data/contributors.yaml
+++ b/site/src/data/contributors.yaml
@@ -7,6 +7,11 @@
# photo: a file in site/src/assets/contributors/ (for example eyalgolan.jpg), supplied by the owner with the person's
# consent. Leave it empty and the card shows a monogram. Never a GitHub avatar, and never a generated or AI image of a
# person.
+# category (optional): team (the default), historian or sensitivity-reviewer. Historians and sensitivity reviewers get
+# their own section on the page.
+# since, until (optional): when the person took part, as YYYY or YYYY-MM, quoted or not. An entry with `until` moves to
+# the Past contributors section with its years. Only the person or the owner supplies these dates.
+# The two sections appear only when someone is in them.
#
# Hebrew titles are gendered. Where the person's preference is not known, the Hebrew uses a neutral wording.
people:
diff --git a/site/src/lib/repo.ts b/site/src/lib/repo.ts
index 367c5619a..f4e2f73db 100644
--- a/site/src/lib/repo.ts
+++ b/site/src/lib/repo.ts
@@ -80,16 +80,39 @@ export function assetRules(): AssetRule[] {
return (readYaml('ASSETS.yaml').rules as AssetRule[]);
}
+export const personCategories = ['team', 'historian', 'sensitivity-reviewer'] as const;
+export type PersonCategory = (typeof personCategories)[number];
+
export interface Person {
github: string;
name: { en?: string; he?: string };
title: { en: string; he: string };
photo?: string | null;
+ category: PersonCategory;
+ since?: string;
+ until?: string;
}
+/** The file the contributors page reads. SITE_CONTRIBUTORS (a path from the repo root) swaps in a test fixture. */
+export const contributorsFile = process.env.SITE_CONTRIBUTORS || 'site/src/data/contributors.yaml';
+
export function contributors(): Person[] {
- const doc = YAML.parse(fs.readFileSync(path.join(repoRoot, 'site/src/data/contributors.yaml'), 'utf8'));
- return doc.people as Person[];
+ const doc = YAML.parse(fs.readFileSync(path.resolve(repoRoot, contributorsFile), 'utf8'));
+ const people = (doc.people ?? []) as (Omit<Person, 'category' | 'since' | 'until'> & { category?: unknown; since?: unknown; until?: unknown })[];
+ const year = /^\d{4}(-\d{2})?$/;
+ return people.map((p) => {
+ const bad = (msg: string) => { throw new Error(`contributors: ${p.github ?? '(no github)'}: ${msg}`); };
+ if (!p.github) bad('no github handle');
+ if (!p.title?.en || !p.title?.he) bad('title needs both en and he');
+ const category = (p.category ?? 'team') as PersonCategory;
+ if (!personCategories.includes(category)) bad(`category must be one of ${personCategories.join(', ')}`);
+ // YAML reads a bare 2024 as a number; keep the text.
+ const since = p.since == null || p.since === '' ? undefined : String(p.since);
+ const until = p.until == null || p.until === '' ? undefined : String(p.until);
+ for (const [k, v] of [['since', since], ['until', until]] as const) if (v && !year.test(v)) bad(`${k} must be YYYY or YYYY-MM, not ${v}`);
+ if (since && until && until < since) bad('until is before since');
+ return { ...p, category, since, until };
+ });
}
/** The first `## Heading` section of a Markdown file, without the heading. */
diff --git a/site/src/pages/[lang]/contributors.astro b/site/src/pages/[lang]/contributors.astro
index 179ce3c09..bf52a33a8 100644
--- a/site/src/pages/[lang]/contributors.astro
+++ b/site/src/pages/[lang]/contributors.astro
@@ -1,6 +1,8 @@
---
// A grid of people from site/src/data/contributors.yaml: photo, name and title in the page's language. Until the owner
// supplies a photo, a monogram. Never a GitHub avatar and never a generated image of a person.
+// Three groups, each shown only when it has someone: the team (no heading, as before), historians and sensitivity
+// reviewers (category), and past contributors (anyone with `until`), with their years.
import { Image } from 'astro:assets';
import type { ImageMetadata } from 'astro';
import Layout from '../../layouts/Layout.astro';
@@ -19,8 +21,28 @@ const people = contributors().map((p) => {
const initials = words.length >= 2 ? (words[0][0] + words[words.length - 1][0]) : (display || p.github)[0];
const photoKey = p.photo ? `../../assets/contributors/${p.photo}` : undefined;
if (photoKey && !photos[photoKey]) throw new Error(`contributors: photo not found: site/src/assets/contributors/${p.photo}`);
- return { ...p, name, nameIsHandle: !display, initials: initials.toUpperCase(), photo: photoKey ? photos[photoKey].default : undefined };
+ return { ...p, name, nameIsHandle: !display, initials: initials.toUpperCase(), photo: photoKey ? photos[photoKey].default : undefined, tenure: tenure(p.since, p.until) };
});
+
+// "2024–2026", "November 2024 – February 2026", "Since March 2025", "Until 2026". The years come from the file, never from the repository history.
+function when(v: string) {
+ if (v.length === 4) return v;
+ return new Intl.DateTimeFormat(he ? 'he-IL' : 'en-GB', { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(new Date(`${v}-01T00:00:00Z`));
+}
+function tenure(since?: string, until?: string) {
+ // A month range takes a spaced dash, which also keeps the Hebrew month names in order in right-to-left text.
+ if (since && until) return since === until ? when(since) : `${when(since)}${since.length + until.length > 8 ? ' – ' : '–'}${when(until)}`;
+ if (since) return he ? `מאז ${when(since)}` : `Since ${when(since)}`;
+ if (until) return he ? `עד ${when(until)}` : `Until ${when(until)}`;
+ return undefined;
+}
+
+const groups = [
+ { id: 'team', heading: undefined, people: people.filter((p) => !p.until && p.category === 'team') },
+ { id: 'reviewers', heading: he ? 'ייעוץ היסטורי ובדיקת רגישות' : 'Historians and sensitivity reviewers',
+ people: people.filter((p) => !p.until && p.category !== 'team') },
+ { id: 'past', heading: he ? 'תרמו בעבר' : 'Past contributors', people: people.filter((p) => p.until) },
+].filter((g) => g.people.length > 0);
---
<Layout lang={lang} page="contributors" title={t(lang, 'nav.contributors')}
description={he ? 'האנשים שבונים את Statecraft: Israel.' : 'The people who build Statecraft: Israel.'}>
@@ -33,24 +55,30 @@ const people = contributors().map((p) => {
: 'The people who have contributed to the project. Credits for the sources, photographs and data are on the Sources page.'}</p>
</header>
- <ul class="people" role="list">
- {people.map((p) => (
- <li>
- <figure class="person">
- {p.photo ? (
- <Image src={p.photo} alt={he ? `תמונה של ${p.name}` : `Photo of ${p.name}`} width={320} height={320} fit="cover" format="webp" class="portrait" loading="lazy" />
- ) : (
- <span class="monogram" role="img" aria-label={`${p.name}: ${t(lang, 'contributors.photo.missing')}`} lang="en" dir="ltr">{p.initials}</span>
- )}
- <figcaption>
- <span class="name" lang={p.nameIsHandle ? 'en' : undefined} dir={p.nameIsHandle ? 'ltr' : undefined}>{p.name}</span>
- <span class="title">{p.title[lang]}</span>
- <a class="gh" href={`https://github.com/${p.github}`} aria-label={`${p.name}: ${t(lang, 'contributors.github')}`} lang="en" dir="ltr">@{p.github}</a>
- </figcaption>
- </figure>
- </li>
- ))}
- </ul>
+ {groups.map((g) => (
+ <section class="group" data-people={g.id} aria-labelledby={g.heading ? `people-${g.id}` : undefined}>
+ {g.heading && <h2 id={`people-${g.id}`}>{g.heading}</h2>}
+ <ul class="people" role="list">
+ {g.people.map((p) => (
+ <li>
+ <figure class="person">
+ {p.photo ? (
+ <Image src={p.photo} alt={he ? `תמונה של ${p.name}` : `Photo of ${p.name}`} width={320} height={320} fit="cover" format="webp" class="portrait" loading="lazy" />
+ ) : (
+ <span class="monogram" role="img" aria-label={`${p.name}: ${t(lang, 'contributors.photo.missing')}`} lang="en" dir="ltr">{p.initials}</span>
+ )}
+ <figcaption>
+ <span class="name" lang={p.nameIsHandle ? 'en' : undefined} dir={p.nameIsHandle ? 'ltr' : undefined}>{p.name}</span>
+ <span class="title">{p.title[lang]}</span>
+ {p.tenure && <span class="tenure">{p.tenure}</span>}
+ <a class="gh" href={`https://github.com/${p.github}`} aria-label={`${p.name}: ${t(lang, 'contributors.github')}`} lang="en" dir="ltr">@{p.github}</a>
+ </figcaption>
+ </figure>
+ </li>
+ ))}
+ </ul>
+ </section>
+ ))}
<div class="prose invite">
{he ? (
@@ -74,6 +102,8 @@ const people = contributors().map((p) => {
figcaption { display: grid; gap: 0.15rem; }
.name { font-weight: 600; font-size: 1.15rem; color: var(--ink); overflow-wrap: anywhere; }
.title { color: var(--gold-light); font-size: 1rem; }
+ .tenure { color: var(--ink-dim); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
+ .group h2 { margin-block-end: 1.25rem; }
.gh { font-size: 0.85rem; color: var(--ink-dim); margin-block-start: 0.35rem; overflow-wrap: anywhere; }
.invite { border-block-start: 1px solid var(--gold-faint); padding-block-start: 1.5rem; }
</style>