Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down
4 changes: 3 additions & 1 deletion src/lab/unit.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ title: "Lab: {{ unit.title }}"
</header>
<section>
<h2>Conversation</h2>
<article class="panel turn"><span class="status status-canon">Speaker A · main text</span><p>The exact canonical unit is one interaction away so this interpretive layer cannot quietly replace it.</p><p><a href="/source/{{ unit.routeSlug }}/">Open exact source and provenance</a></p></article>
<article class="panel turn"><span class="status status-canon">Speaker A · main text</span>
<blockquote class="reading">{% for line in unit.content | canonUnitBody %}<p>{{ line }}</p>{% endfor %}</blockquote>
<p><a href="/source/{{ unit.routeSlug }}/">Open exact source and provenance</a></p></article>
{% if unit.notes.length %}
{% for note in unit.notes %}<article class="panel turn note"><span class="status status-interpretation">Speaker B · note {{ note.marker }}</span><p>{{ note.text }}</p></article>{% endfor %}
{% else %}
Expand Down
Loading