Fix Matins occasion label reusing winner-centric day label
occasionName's fallback reused getDayLabel(day), which is winner-centric -- when a sanctoral feast wins the day, it returns the winner's own full label including rank (e.g. "All Saints (Duplex I Class)"), so a reading tagged with the governing Sunday's temporal id got wrapped as "(for All Saints (Duplex I Class))" instead of naming the Sunday. Exports day-label.ts's existing temporalLabel helper (the plain ordinal Sunday/ feria name, independent of who won) and uses it instead whenever a saint has won the day. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGsATZvfnpQ81HQuoF5JuL
This commit is contained in:
@@ -320,7 +320,14 @@ function trinitytideOverrideLabel(day: LiturgicalDay): Bi | undefined {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function temporalLabel(day: LiturgicalDay): Bi {
|
/** The plain temporal/Sunday-or-feria name only (ordinal week/season
|
||||||
|
* phrasing, e.g. "The Twenty-fourth Sunday after Pentecost"), independent of
|
||||||
|
* who actually won the day — i.e. what the day would be called if the
|
||||||
|
* temporal cycle were the winner. Exported for callers (e.g.
|
||||||
|
* `hours/matins.ts`'s `occasionName`) that want to name the governing
|
||||||
|
* Sunday/feria without repeating a sanctoral winner's own rank-qualified
|
||||||
|
* label from `getDayLabel`. */
|
||||||
|
export function temporalLabel(day: LiturgicalDay): Bi {
|
||||||
const trinitytideOverride = trinitytideOverrideLabel(day);
|
const trinitytideOverride = trinitytideOverrideLabel(day);
|
||||||
if (trinitytideOverride) {
|
if (trinitytideOverride) {
|
||||||
return trinitytideOverride;
|
return trinitytideOverride;
|
||||||
|
|||||||
+7
-2
@@ -71,7 +71,7 @@ import type { ResolvedOrdo, ResolvedPart, ResolvedText, ResolvedVerse } from './
|
|||||||
import type { LiturgicalDay, DayWinner } from '../calendar/types';
|
import type { LiturgicalDay, DayWinner } from '../calendar/types';
|
||||||
import { resolveDay, resolveTemporalId, monthWeekId, activeOctavesFor, resolveActiveOctave, isAtLeast } from '../calendar';
|
import { resolveDay, resolveTemporalId, monthWeekId, activeOctavesFor, resolveActiveOctave, isAtLeast } from '../calendar';
|
||||||
import { isInTriduum } from '../calendar/temporal';
|
import { isInTriduum } from '../calendar/temporal';
|
||||||
import { getDayLabel, emberDayLabel } from '../calendar/day-label';
|
import { getDayLabel, emberDayLabel, temporalLabel } from '../calendar/day-label';
|
||||||
import { getPsalmVerses } from '../psalter';
|
import { getPsalmVerses } from '../psalter';
|
||||||
import { getPsalmsFor, type PsalmRef } from '../psalter/distribution';
|
import { getPsalmsFor, type PsalmRef } from '../psalter/distribution';
|
||||||
import { getScriptureVerses } from '../scripture';
|
import { getScriptureVerses } from '../scripture';
|
||||||
@@ -799,7 +799,12 @@ function occasionName(id: string, day: LiturgicalDay): string | undefined {
|
|||||||
if (named) return named;
|
if (named) return named;
|
||||||
const monthWeek = monthWeekId(day.date);
|
const monthWeek = monthWeekId(day.date);
|
||||||
if (id === resolveTemporalId(day.date) || (monthWeek && id === `month-week-${monthWeek}`)) {
|
if (id === resolveTemporalId(day.date) || (monthWeek && id === `month-week-${monthWeek}`)) {
|
||||||
return getDayLabel(day).en;
|
// When a saint (not the temporal day itself) won the day, name the
|
||||||
|
// plain Sunday/feria only — `getDayLabel`'s own text is winner-centric
|
||||||
|
// (the winning saint's full name + rank), which would otherwise get
|
||||||
|
// pointlessly repeated back into its own "(for ...)" annotation, since
|
||||||
|
// the winner's name is already shown elsewhere as the day's heading.
|
||||||
|
return day.winner.kind === 'sanctoral' ? temporalLabel(day).en : getDayLabel(day).en;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user