scripture: add a dedicated non-Psalm scripture store, migrate pure-scripture readings
Deploy / deploy (push) Successful in 46s

Adds src/scripture/ (types.ts, index.ts), a verse-addressable store mirroring
psalter/index.ts's own pattern exactly -- getScriptureVerses(book, chapter,
range) -- for non-Psalm scripture (Wisdom, Canticles, Ezekiel, Acts, Joel,
etc.). Kept as its own module, not folded into the Psalter, per 2026-08
discussion ("the psalms kind of work differently even if the logic is the
same, they do need their own store").

Octave readings can now declare `passages: [{ book, chapter, verses }]`
instead of embedding text -- each entry becomes its own paragraph, letting a
reading built from several verse ranges keep its original paragraph breaks.
getOctaveReading resolves either shape (embedded text or passages) into the
same OctaveReadingText callers already expect, so nothing downstream needs
to know which was used. Scope, per discussion: only readings that are
Scripture start to finish get this treatment -- prose that merely quotes a
verse or two (most of the patristic sermons pulled so far) keeps its
quotations embedded inline, as before.

Migrates the 9 already-committed octave readings that are pure Scripture
(Wisdom 4:7-20, Canticles 1 and 8, seven different Ezekiel excerpts across
All Saints' octave -- one of which, day 7, genuinely spans two chapters --
and Acts 19/Joel 2 for Pentecost's octave) to the new passages notation,
verified to resolve to character-identical text as before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-11 10:06:10 -04:00
parent 589c4be0d7
commit 49bd7f7858
30 changed files with 1003 additions and 284 deletions
+15
View File
@@ -28,4 +28,19 @@ describe('getOctaveReading', () => {
expect(reading?.status.en).toBe('missing');
expect(reading?.text.en).toBeUndefined();
});
it('resolves a reading declared as scripture passages into continuous text, one paragraph per passage', () => {
const reading = getOctaveReading('all-saints', 2);
const paragraphs = reading?.text.la?.split('\n\n') ?? [];
expect(paragraphs.length).toBe(3);
expect(paragraphs[0]).toContain('1 Et factum est');
expect(reading?.text.en).toContain('1 Now it came to pass');
});
it('resolves a scripture passage reading that spans two chapters', () => {
const reading = getOctaveReading('all-saints', 7);
const paragraphs = reading?.text.la?.split('\n\n') ?? [];
expect(paragraphs.length).toBe(3); // Ezek 15:1-5, 15:6-8, 16:1-5
expect(paragraphs[2]).toContain('notas fac Jerúsalem');
});
});
+24
View File
@@ -0,0 +1,24 @@
import { describe, expect, it } from 'vitest';
import { getScriptureChapter, getScriptureVerses } from '../../src/scripture';
describe('getScriptureVerses', () => {
it('resolves a verse range within an authored chapter', () => {
const verses = getScriptureVerses('ezek', 1, '4-6');
expect(verses.map((v) => v.n)).toEqual([4, 5, 6]);
expect(verses[0]?.text.la).toContain('túrbinis');
});
it('resolves the whole chapter when no range is given', () => {
expect(getScriptureVerses('ezek', 1).length).toBe(9);
});
it('includes a verse that appears twice in the source at the same number (a real Vulgate numbering quirk, not a bug)', () => {
const verses = getScriptureVerses('sap', 4, '13-16');
expect(verses.filter((v) => v.n === 14).length).toBe(2);
});
it('is empty, not throwing, for an unauthored book/chapter', () => {
expect(getScriptureVerses('gen', 1)).toEqual([]);
expect(getScriptureChapter('gen', 1)).toBeUndefined();
});
});