aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/naming/lang.ml7
-rw-r--r--lib/naming/lang.mli6
-rw-r--r--lib/render/view.ml6
3 files changed, 17 insertions, 2 deletions
diff --git a/lib/naming/lang.ml b/lib/naming/lang.ml
index 147a49b..92c8a9a 100644
--- a/lib/naming/lang.ml
+++ b/lib/naming/lang.ml
@@ -14,6 +14,7 @@ type t = {
rank : table;
colour : table;
term : table;
+ rite : table;
chain : t option; (** consulted when this table misses *)
}
@@ -32,6 +33,7 @@ let season t k = get t (fun x -> x.season) k
let rank t k = get t (fun x -> x.rank) k
let colour t k = get t (fun x -> x.colour) k
let term t k = get t (fun x -> x.term) k
+let rite t k = get t (fun x -> x.rite) k
let weekday_key = [| "sunday"; "monday"; "tuesday"; "wednesday"; "thursday"; "friday"; "saturday" |]
@@ -58,7 +60,7 @@ let fallback_code t = t.fallback_code
let raw =
{ code = "raw"; fallback_code = None; celebration = empty_table; weekday = empty_table;
month = empty_table; season = empty_table; rank = empty_table; colour = empty_table;
- term = empty_table; chain = None }
+ term = empty_table; rite = empty_table; chain = None }
let with_fallback t base = { t with chain = Some base }
@@ -98,6 +100,7 @@ let of_string text =
rank = find "rank";
colour = find "colour";
term = find "term";
+ rite = find "rite";
chain = None })
let keys t =
@@ -105,5 +108,5 @@ let keys t =
List.concat
[ qualify "celebration" t.celebration; qualify "weekday" t.weekday;
qualify "month" t.month; qualify "season" t.season; qualify "rank" t.rank;
- qualify "colour" t.colour; qualify "term" t.term ]
+ qualify "colour" t.colour; qualify "term" t.term; qualify "rite" t.rite ]
|> List.sort compare
diff --git a/lib/naming/lang.mli b/lib/naming/lang.mli
index 36931d4..4d7f82f 100644
--- a/lib/naming/lang.mli
+++ b/lib/naming/lang.mli
@@ -49,6 +49,12 @@ val rank : t -> string -> string
val colour : t -> string -> string
val term : t -> string -> string
+(** A rite id's reader-facing display name (e.g. ["ef"] ->
+ ["Missale Romanum, editio typica 1962"]). A miss returns the id itself,
+ same TOTAL-lookup contract as every other function here -- the same
+ degradation an unnamed slug already gets, not a special case. *)
+val rite : t -> string -> string
+
(** [weekday t n], 0 = Sunday. Out-of-range [n] returns [string_of_int n]. *)
val weekday : t -> int -> string
diff --git a/lib/render/view.ml b/lib/render/view.ml
index bbb8c7d..7bd5416 100644
--- a/lib/render/view.ml
+++ b/lib/render/view.ml
@@ -191,6 +191,12 @@ let of_days ~lang ~vocab ~rite ~year days =
in
T.Obj
[ ("rite", str rite);
+ (* The reader-facing display name (lang/*.ini's own [rite] section,
+ Defect 1) -- [rite] itself stays the stable internal key, exactly
+ as [slug] is kept beside [name] on a day/commemoration. Every
+ template that used to print the bare id ("ef") now prints this
+ field instead. *)
+ ("rite_name", str (Lang.rite lang rite));
("year", str (string_of_int year));
("term", term_value lang);
("weekday_headings", weekday_headings lang);