Skip to content

Commit dd7abee

Browse files
Capture compact superscript footnotes in canon parser
1 parent 4a574ba commit dd7abee

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

scripts/parse-canon.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import slugify from 'slugify';
99
// tests: tests/canon-integrity.test.mjs
1010
// === END MODULE_BUILD ===
1111

12-
const parserVersion = '0.4.0';
12+
const parserVersion = '0.4.1';
1313
const provenance = JSON.parse(await readFile('src/_data/snapshots/canon.provenance.json', 'utf8'));
1414
const raw = await readFile('src/_data/snapshots/canon.last-known-good.md', 'utf8');
1515
const text = raw.replace(/^---\n[\s\S]*?\n---\n/, '');
@@ -54,8 +54,13 @@ function extractNotes(content) {
5454
notes.push({ marker: `[${bracket[1]}]`, text: bracket[2].trim() });
5555
continue;
5656
}
57-
const numbered = /^\s*>?\s*([¹²³]+|\d+)\s+(.+)$/.exec(line);
58-
if (numbered) notes.push({ marker: numbered[1], text: numbered[2].trim() });
57+
const superscript = /^\s*>?\s*([¹²³]+)\s*(.+)$/.exec(line);
58+
if (superscript) {
59+
notes.push({ marker: superscript[1], text: superscript[2].trim() });
60+
continue;
61+
}
62+
const digit = /^\s*>?\s*(\d+)\s+(.+)$/.exec(line);
63+
if (digit) notes.push({ marker: digit[1], text: digit[2].trim() });
5964
}
6065
return notes;
6166
}

0 commit comments

Comments
 (0)