aboutsummaryrefslogtreecommitdiff
path: root/lib/rites/rite_of/lectionary_of.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rites/rite_of/lectionary_of.ml')
-rw-r--r--lib/rites/rite_of/lectionary_of.ml36
1 files changed, 34 insertions, 2 deletions
diff --git a/lib/rites/rite_of/lectionary_of.ml b/lib/rites/rite_of/lectionary_of.ml
index 1664fad..eb3e4e0 100644
--- a/lib/rites/rite_of/lectionary_of.ml
+++ b/lib/rites/rite_of/lectionary_of.ml
@@ -60,6 +60,24 @@ let lookup_any lectionary ~year_start base date =
| Some cs -> Some cs
| None -> Lectionary.find lectionary (with_suffix (weekday_cycle_letter (weekday_cycle ~year_start date))))
+(* See lectionary_of.mli's own doc comment for the full citation (OLM n.
+ 69.3) and argument. Kept as ordinary [Printf.sprintf] string
+ construction, not a lookup table, so tools/bootstrap_lectionary_of.ml's
+ own reachability sweep (which calls this function directly, not a
+ hand-copied re-implementation) and this module's own runtime lookup can
+ never drift apart -- the single failure mode a hand-duplicated version
+ in each place would invite. *)
+let date_keyed_slug date =
+ if Date.weekday date = Date.Sun then None
+ else
+ let m = Date.month date and dd = Date.day date in
+ if m = 12 && dd >= 17 && dd <= 24 then Some (Slug.of_string_exn (Printf.sprintf "of-advent-dec-%d" dd))
+ else if m = 12 && dd >= 29 && dd <= 31 then
+ Some (Slug.of_string_exn (Printf.sprintf "of-christmas-dec-%d" dd))
+ else if m = 1 && ((dd >= 2 && dd <= 5) || dd = 7) then
+ Some (Slug.of_string_exn (Printf.sprintf "of-christmas-jan-%d" dd))
+ else None
+
let readings ~lectionary ~year_start ~(observed : Vocab_of.rank Celebration.t)
~(temporal : (Vocab_of.season, Vocab_of.rank) Temporal.t) ~date ~temporal_at:_ =
match observed.Celebration.citations with
@@ -99,9 +117,23 @@ let readings ~lectionary ~year_start ~(observed : Vocab_of.rank Celebration.t)
Mass_formulary.source was never built to carry. *)
(Some { Mass_formulary.said = Some observed.Celebration.slug; via = Mass_formulary.Proper }, cs)
| None -> (
- match lookup_any lectionary ~year_start temporal.Temporal.office.Celebration.slug date with
+ (* OLM n. 69.3's own date-fixed windows (see date_keyed_slug's
+ own doc comment): tried BEFORE the ordinary weekday-keyed
+ slug lookup, not instead of it, so every other temporal day
+ is unaffected -- this branch only ever hits inside the two
+ named civil-date windows, and [date_keyed_slug] itself
+ already refuses a Sunday, where a NAMED Sunday office (never
+ one of these weekday-keyed ferial slugs) is what temporal.
+ office actually names. *)
+ match (match date_keyed_slug date with Some s -> Lectionary.find lectionary s | None -> None) with
| Some cs ->
( Some { Mass_formulary.said = Some temporal.Temporal.office.Celebration.slug;
via = Mass_formulary.Own_slug },
cs )
- | None -> (None, [])))
+ | None -> (
+ match lookup_any lectionary ~year_start temporal.Temporal.office.Celebration.slug date with
+ | Some cs ->
+ ( Some { Mass_formulary.said = Some temporal.Temporal.office.Celebration.slug;
+ via = Mass_formulary.Own_slug },
+ cs )
+ | None -> (None, []))))