Rebuild split-rulebook journal parsing (vault sync 2026-08-18 to 08-23) #1

Merged
octoturge merged 1 commits from foundry-sync-2026-08-23 into main 2026-08-23 10:00:56 +02:00
Owner

The bab5a62 vault commit split 9 rulebook monoliths into hub/ToC pages plus per-topic-file subfolders (rules/NN. //.md). The existing chapter-slicing parser (parseJournalBook) relied on finding a duplicate TOC-vs-body heading pair per chapter; after the split each hub heading only occurs once (in the ToC), so it was silently treating the ToC's link-list body as if it were real chapter content.

Fix

Added parseSplitBookFolder (journal-parser.ts): walks a book's split subfolder directly, one JournalDoc per Rozdzial/Aneks subfolder-or-file, one JournalPage per topic file (or a single page for a standalone chapter file). The hub's own Wstep intro paragraph is unaffected by the split (still real prose, not a link) and continues to come from the existing prefaceTitle preface-extraction logic.

Wired into build-journal-packs.ts for the 6 affected packs: core-rules-lore, bestiary-lore, magic-book-lore, abyss, blood-magic-history, economy. crimson-cult's rules source was never split into a subfolder, so it's left on the old code path unchanged.

Also fixed a pre-existing derivePageTitle bug (page titles kept a leading markdown heading marker, e.g. "## Wstep" instead of "Wstep") to match the already-correct behavior in topical-parser.ts.

Verification

bun run scripts/build-journal-packs.ts runs clean; confirmed all 4 new spells, new/renamed talents, and all 7 new Bestiariusz NPCs flow through into the compiled packs.

The bab5a62 vault commit split 9 rulebook monoliths into hub/ToC pages plus per-topic-file subfolders (rules/NN. <Book>/<Chapter>/<Topic>.md). The existing chapter-slicing parser (parseJournalBook) relied on finding a duplicate TOC-vs-body heading pair per chapter; after the split each hub heading only occurs once (in the ToC), so it was silently treating the ToC's link-list body as if it were real chapter content. ## Fix Added `parseSplitBookFolder` (journal-parser.ts): walks a book's split subfolder directly, one JournalDoc per Rozdzial/Aneks subfolder-or-file, one JournalPage per topic file (or a single page for a standalone chapter file). The hub's own Wstep intro paragraph is unaffected by the split (still real prose, not a link) and continues to come from the existing prefaceTitle preface-extraction logic. Wired into build-journal-packs.ts for the 6 affected packs: core-rules-lore, bestiary-lore, magic-book-lore, abyss, blood-magic-history, economy. crimson-cult's rules source was never split into a subfolder, so it's left on the old code path unchanged. Also fixed a pre-existing derivePageTitle bug (page titles kept a leading markdown heading marker, e.g. "## Wstep" instead of "Wstep") to match the already-correct behavior in topical-parser.ts. ## Verification `bun run scripts/build-journal-packs.ts` runs clean; confirmed all 4 new spells, new/renamed talents, and all 7 new Bestiariusz NPCs flow through into the compiled packs.
octoturge added 1 commit 2026-08-23 08:51:27 +02:00
The bab5a62 vault commit split 9 rulebook monoliths into hub/ToC pages plus
per-topic-file subfolders (rules/NN. <Book>/<Chapter>/<Topic>.md). The
existing chapter-slicing parser (parseJournalBook) relied on finding a
duplicate TOC-vs-body heading pair per chapter; after the split each hub
heading only occurs once (in the ToC), so it was silently treating the
ToC's link-list body as if it were real chapter content.

Added parseSplitBookFolder (journal-parser.ts): walks a book's split
subfolder directly, one JournalDoc per Rozdzial/Aneks subfolder-or-file,
one JournalPage per topic file (or a single page for a standalone chapter
file). The hub's own Wstep intro paragraph is unaffected by the split (it's
still real prose, not a link) and continues to come from the existing
prefaceTitle preface-extraction logic.

Wired into build-journal-packs.ts for the 6 affected packs: core-rules-lore,
bestiary-lore, magic-book-lore, abyss, blood-magic-history, economy.
crimson-cult's rules source was never split into a subfolder, so it's left
on the old code path unchanged.

Also fixed a pre-existing derivePageTitle bug (page titles kept a leading
markdown heading marker, e.g. "## Wstep" instead of "Wstep") to match the
already-correct behavior in topical-parser.ts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
octoturge merged commit 509ec5454e into main 2026-08-23 10:00:56 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: octoturge/hbm-foundry-lore#1