propers: add the temporal collects store, 52 Sunday collects
New data/propers/temporal/*.yml and propers/index.ts's getTemporalProper,
mirroring the existing common-propers store. Populated with all 52
distinct Sunday collects for the full liturgical year (Advent 1-4, the
Christmas-octave Sunday, Epiphany 1-6, Septuagesima-tide, Lent 1-4 +
Passion + Palm Sunday, the 8 Paschal-time Sundays through Pentecost, and
post-Pentecost 1-24), each verified against the real Monastic Tridentinum
1617 engine.
Keyed Pentecost/offset-based ("post-pentecost-N-collect"), not
Trinity-counted — that's a display choice for calendar/day-label.ts, kept
independent of this content's storage identity. 8 of the 52 needed to be
read directly from the reference engine's source files plus its standard
closing-formula macros, since a real saint outranks those particular
Sundays on every candidate year checked and a live date query would only
ever return the saint's own collect.
This commit is contained in:
+34
-9
@@ -1,19 +1,29 @@
|
||||
import type { ProperText } from './types';
|
||||
|
||||
// Only the "common" propers store exists so far — sanctoral/temporal propers
|
||||
// (source: 'sanctoral' | 'temporal') are milestone-4 concerns and have no
|
||||
// data directory yet.
|
||||
const modules = import.meta.glob<{ default: ProperText }>('../data/propers/common/*.yml', {
|
||||
// "common" and "temporal" propers stores exist; "sanctoral" propers text
|
||||
// (as opposed to calendar/feasts.ts's rank/name metadata) doesn't yet —
|
||||
// none of the 7 saints in data/calendar/saints/*.yml have real collect
|
||||
// text authored (all `propers: null`).
|
||||
const commonModules = import.meta.glob<{ default: ProperText }>('../data/propers/common/*.yml', {
|
||||
eager: true,
|
||||
});
|
||||
const temporalModules = import.meta.glob<{ default: ProperText }>('../data/propers/temporal/*.yml', {
|
||||
eager: true,
|
||||
});
|
||||
|
||||
const commonPropers = new Map<string, ProperText>();
|
||||
for (const mod of Object.values(modules)) {
|
||||
commonPropers.set(mod.default.id, mod.default);
|
||||
function toMap(modules: Record<string, { default: ProperText }>): Map<string, ProperText> {
|
||||
const map = new Map<string, ProperText>();
|
||||
for (const mod of Object.values(modules)) {
|
||||
map.set(mod.default.id, mod.default);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
export function getCommonProper(id: string): ProperText {
|
||||
const proper = commonPropers.get(id);
|
||||
const commonPropers = toMap(commonModules);
|
||||
const temporalPropers = toMap(temporalModules);
|
||||
|
||||
function resolve(store: Map<string, ProperText>, id: string): ProperText {
|
||||
const proper = store.get(id);
|
||||
if (proper) {
|
||||
return proper;
|
||||
}
|
||||
@@ -22,4 +32,19 @@ export function getCommonProper(id: string): ProperText {
|
||||
return { id, text: {}, status: { la: 'missing', en: 'missing' } };
|
||||
}
|
||||
|
||||
export function getCommonProper(id: string): ProperText {
|
||||
return resolve(commonPropers, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporal propers (currently: Sunday collects only — see
|
||||
* data/propers/temporal/*.yml) are keyed Pentecost/offset-based
|
||||
* ("post-pentecost-N-collect"), not Trinity-counted — that's a display
|
||||
* choice that lives in calendar/day-label.ts, not a content-storage
|
||||
* concern. See that file's header for the full id scheme.
|
||||
*/
|
||||
export function getTemporalProper(id: string): ProperText {
|
||||
return resolve(temporalPropers, id);
|
||||
}
|
||||
|
||||
export type { ProperText } from './types';
|
||||
|
||||
Reference in New Issue
Block a user