Skip to content

Commit a58e46d

Browse files
TMHSDigitalclaude
andcommitted
Review fixes: page check uses this build's output, list-item comment guard, absolute issue link, filtered suggestions
- build: checkPages resolves link targets against the set of files this build produced, so an incremental build fails on a link to a removed entry instead of passing against last time's page and then pruning it - frontmatter: a block-list item cut at " #word", or reduced to nothing by a leading #, is reported like a key: value line is - reverify: the CONTRIBUTING link is absolute (a relative link in an issue body resolves under /issues/ and 404s) - app: "Did you mean" draws only from entries the category and other filters would show, so a suggestion never leads back to the empty state Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 99f5d6a commit a58e46d

5 files changed

Lines changed: 33 additions & 10 deletions

File tree

‎site/build.mjs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,13 @@ function writeEntryPages({ entries, bodies, config, stats, stamp, hasCard, now,
535535

536536
/** Runs the page checks over dist-relative files. */
537537
function checkPages(files) {
538+
// Link targets resolve against what this build produced, not what is on
539+
// disk: an incremental build still has last time's pages there until
540+
// pruneDist runs, and a link to a removed entry must fail now.
538541
const kindOf = (rel) => {
539-
const full = path.join(DIST, rel);
540-
if (!fs.existsSync(full)) return null;
541-
if (fs.statSync(full).isDirectory()) return fs.existsSync(path.join(full, "index.html")) ? "dir" : null;
542-
return "file";
542+
if (produced.has(rel)) return "file";
543+
if (produced.has(rel ? `${rel}/index.html` : "index.html")) return "dir";
544+
return null;
543545
};
544546
return files.flatMap((f) => checkPage(fs.readFileSync(path.join(DIST, f), "utf8"), { file: f, kindOf }));
545547
}

‎site/lib/frontmatter.mjs‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ function stripComment(raw) {
5757
return raw;
5858
}
5959

60+
/**
61+
* True when an unquoted bare scalar lost a ` #word` to the comment rule. A
62+
* hash with no space after it is a hashtag or a colour, not a comment
63+
* (`# text`); say so, since the silent truncation is what hurts.
64+
*/
65+
function cutAtHash(raw, value) {
66+
return /\S\s+#\S/.test(raw) && typeof value === "string" && value !== "" && !/^["'[]/.test(raw.trim());
67+
}
68+
6069
export function parseScalar(raw) {
6170
const v = stripComment(raw).trim();
6271
if (v === "true") return true;
@@ -92,7 +101,12 @@ export function parseFrontmatter(text) {
92101
const item = line.match(/^\s+-\s+(.*)$/);
93102
if (item) {
94103
if (listKey === null) errors.push(`line ${lineNo}: list item without a key above it`);
95-
else meta[listKey].push(parseScalar(item[1]));
104+
else {
105+
const value = parseScalar(item[1]);
106+
if (value === null) errors.push(`line ${lineNo}: list item is empty (a value starting with # is a comment; quote it)`);
107+
else if (cutAtHash(item[1], value)) errors.push(`line ${lineNo}: list item is cut at " #" (read as a comment); quote the value if the # is part of it`);
108+
else meta[listKey].push(value);
109+
}
96110
return;
97111
}
98112
listKey = null;
@@ -108,9 +122,7 @@ export function parseFrontmatter(text) {
108122
}
109123
const rawValue = line.slice(idx + 1);
110124
const value = parseScalar(rawValue);
111-
// ` #word` with no space after the hash is a hashtag or a colour, not a
112-
// comment (`# text`); say so, since the silent truncation is what hurts.
113-
if (/\S\s+#\S/.test(rawValue) && typeof value === "string" && value && !/^["'[]/.test(rawValue.trim())) {
125+
if (cutAtHash(rawValue, value)) {
114126
errors.push(`line ${lineNo}: "${key}" is cut at " #" (read as a comment); quote the value if the # is part of it`);
115127
}
116128
// A block list may start after blank or comment lines under its key.

‎site/lib/lib.test.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,9 @@ eq("frontmatter has no errors with comments everywhere", f2.errors.join(), "");
618618
eq("frontmatter keeps a quoted boolean as text", fm(["id: a", 'commercial: "true"']).meta.commercial, "true");
619619
has("frontmatter flags a hashtag read as a comment", fm(["id: a", "name: Sonniss #GameAudioGDC Bundle"]).errors.join(), '"name" is cut at " #"');
620620
eq("frontmatter keeps a quoted hashtag", fm(["id: a", 'name: "Sonniss #GameAudioGDC Bundle"']).meta.name, "Sonniss #GameAudioGDC Bundle");
621+
has("frontmatter flags a list item cut at a hashtag", fm(["id: a", "tags:", " - foo #bar"]).errors.join(), 'line 4: list item is cut at " #"');
622+
has("frontmatter flags a list item that is only a hashtag", fm(["id: a", "tags:", " - #gamedev"]).errors.join(), "line 4: list item is empty");
623+
eq("frontmatter keeps a commented list item", JSON.stringify(fm(["id: a", "tags:", " - foo # a note", ' - "bar #baz"']).meta.tags), JSON.stringify(["foo", "bar #baz"]));
621624
eq("evidence stops at the next heading, whatever its letter", evidenceSection("## Evidence\n\n- e (2026-01-01)\n\n## Extras\n\n- x"), "## Evidence\n\n- e (2026-01-01)\n");
622625
eq("summary keeps underscores", summaryFromBody("Split by Rig_Medium and **KHR_draco**.\n\n## Notes"), "Split by Rig_Medium and KHR_draco.");
623626
eq("summary keeps C# and link text", summaryFromBody("# T\n\nA [C#](x.md) library, `code`, *em*."), "A C# library, code, em.");
@@ -859,6 +862,7 @@ import { batchIssueMarkdown, pickBatch } from "./reverify.mjs";
859862
has("batch issue says what was recorded", md, "recorded as `CC0`, needs-review, verified 2026-06-01 (153 days ago)");
860863
has("batch issue handles no date", md, "[`undated`](https://github.com/o/r/blob/main/catalog/2d/undated.md): `https://undated.test/`, recorded as `CC0`, active, no verified date");
861864
has("batch issue explains the steps", md, "**How to do one**");
865+
has("batch issue links CONTRIBUTING absolutely (relative links 404 from an issue)", md, "[CONTRIBUTING.md](https://github.com/o/r/blob/main/CONTRIBUTING.md)");
862866
eq("batch issue has one checkbox per entry", (md.match(/^- \[ \] /gm) || []).length, 2);
863867
}
864868

‎site/lib/reverify.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function batchIssueMarkdown({ batch, repo, date, total, dueDays = DUE_DAY
4444
"3. If it still supports the entry, update `verified` to today's date and add a dated quote under `## Evidence`, for example `- Terms page (YYYY-MM-DD): \"...\"`.",
4545
"4. If the terms are unclear, mixed per file, or have changed, set `status: needs-review` and note what you found under `## Notes`. If the source is gone, say so in a comment and we will deprecate it.",
4646
"",
47-
"The rule is in [CONTRIBUTING.md](CONTRIBUTING.md): a wrong licence claim is worse than a missing entry, so never infer a licence from the site's reputation. One PR per entry or a few at a time is fine. `npm run validate` checks the file; CI runs it on your PR.",
47+
`The rule is in [CONTRIBUTING.md](${repo}/blob/main/CONTRIBUTING.md): a wrong licence claim is worse than a missing entry, so never infer a licence from the site's reputation. One PR per entry or a few at a time is fine. \`npm run validate\` checks the file; CI runs it on your PR.`,
4848
"",
4949
"**Entries** (oldest check first)",
5050
"",

‎site/public/app.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,12 @@ import { closestEntries, passesFilters as passes, queryTests as compileQuery, re
434434
const host = $("#empty-suggest");
435435
if (!host) return;
436436
const q = String(query || "").trim();
437-
const matches = q ? closestEntries(slugOf(q), data.entries) : [];
437+
// Only entries the other filters would show: a suggestion that the
438+
// Audio chip then hides would lead straight back to this empty state.
439+
const pool = q
440+
? data.entries.filter((e) => (state.category === "all" || e.category === state.category) && passes(e, { ...state, q: "" }, FORMAT_GROUPS))
441+
: [];
442+
const matches = q ? closestEntries(slugOf(q), pool) : [];
438443
if (!matches.length) {
439444
host.hidden = true;
440445
host.textContent = "";

0 commit comments

Comments
 (0)