Centralize antiphon opening-doubling logic across all hours

The same idiom (splitNamedAntiphon + isDoubleOrHigher(...) ? full :
incipit) was copy-pasted at 11 call sites across 8 hour files. Add one
shared openingAntiphon(antiphon, winner) helper in resolve-common.ts
and use it everywhere a psalm/canticle antiphon's opening form is
decided. Pure dedup, no behavior change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F25189JqjXddUhU9hM9nUS
This commit is contained in:
2026-08-24 07:13:38 -04:00
parent f8de318b7f
commit 8f55ec6931
9 changed files with 55 additions and 36 deletions
+3 -2
View File
@@ -14,6 +14,7 @@ import {
resolveCommon,
appendDoxology,
splitNamedAntiphon,
openingAntiphon,
resolveOfficeWinner,
resolveMinorHourAntiphon,
isSundayOrFeastOffice,
@@ -65,11 +66,11 @@ function resolvePart(part: HourPart, date: string, day: LiturgicalDay): Resolved
}
{
const psalmRefs = getPsalmsFor('prime', day.weekday);
const { incipit, full } = splitNamedAntiphon(resolveMinorHourAntiphon('prime', day, antiphons[day.weekday]));
const antiphonText = resolveMinorHourAntiphon('prime', day, antiphons[day.weekday]);
// Full text on a Double-or-higher feast, otherwise just the incipit
// — see hours/antiphon.ts. The full repeat comes later, after the
// Creed (see 'closing-antiphon'), not tacked onto the last psalm.
const opening = isDoubleOrHigher(resolveOfficeWinner(day)) ? full : incipit;
const opening = openingAntiphon(antiphonText, resolveOfficeWinner(day));
return psalmRefs.map((ref, i) => {
const rawVerses = getPsalmVerses(ref.number, ref.verses).map((v) => ({ n: v.n, text: v.text, status: v.status }));
const { verses, antiphon } = applyFlexaMark(rawVerses, i === 0 ? opening : undefined);