From 55d0b39e052f3526dfc4e9045595f7c557d81b78 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 28 Jul 2026 19:47:53 +0000 Subject: [PATCH] Show the canonical article body with its footnotes on Lab unit pages The Lab conversation previously rendered only the parsed notes plus a link to the exact source, so the reviewed layers sat next to footnotes whose article was absent. Speaker A now renders the exact canonical body via a canonUnitBody filter that mirrors the body extraction in verify-article-canon.mjs, keeping the provenance link and the Speaker B note turns unchanged. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01E93Rxmrs8bXHtWjD7z94bi --- .eleventy.js | 15 +++++++++++++++ src/lab/unit.njk | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index 2e39dce..b9553ec 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -22,6 +22,21 @@ export default function configureEleventy(eleventyConfig) { eleventyConfig.addFilter('where', (items, key, value) => (items || []).filter(item => item?.[key] === value)); eleventyConfig.addFilter('statusClass', value => `status-${String(value || 'hmmm').toLowerCase().replace(/[^a-z0-9]+/g, '-')}`); eleventyConfig.addFilter('markdown', value => md.render(String(value || ''))); + // Exact canonical body lines of a unit: skip the heading line, stop before + // footnote lines, notes blocks, separators, and sub-headings. Mirrors the + // body extraction in scripts/verify-article-canon.mjs; keep the two in step. + eleventyConfig.addFilter('canonUnitBody', content => { + const lines = String(content || '').split(/\r?\n/).slice(1); + const body = []; + for (const line of lines) { + if (/^\s*>?\s*(?:\[[^\]]+\]|[⁰¹²³⁴⁵⁶⁷⁸⁹]+|\d+)\s+/.test(line)) break; + if (/^\s*\*\*\[Notes/.test(line)) break; + if (/^\s*---\s*$/.test(line)) break; + if (/^\s*#{2,}\s/.test(line)) break; + if (line.trim()) body.push(line.trim()); + } + return body; + }); return { dir: { input: 'src', output: '_site', includes: '_includes', data: '_data' }, diff --git a/src/lab/unit.njk b/src/lab/unit.njk index 539a07b..c84137c 100644 --- a/src/lab/unit.njk +++ b/src/lab/unit.njk @@ -18,7 +18,9 @@ title: "Lab: {{ unit.title }}"

Conversation

- + {% if unit.notes.length %} {% for note in unit.notes %}
Speaker B · note {{ note.marker }}

{{ note.text }}

{% endfor %} {% else %}