From 27606c42b7506ab7ffc7f1bd32d4d4a72c6400c8 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 20 Aug 2026 16:43:04 +0200 Subject: feat(render): citations render through Sigla at both call sites View.citation_ref and readings' part_ref are the only two places a citation reaches output; every emitter goes through View. --raw passes Sigla.verbatim rather than a style built over Lang.raw: an identity name table would still reformat punctuation and renumber. Loosen reject_sigla_for: --sigla-style/--sigla-book/--sigla-tradition now actually render on readings/table/render/emit/publish (each builds its own Sigla.t via the new load_sigla), and stay refused only on commands that render no citation (day, easter, temporal, ...). names_of degrades a Lang.bible miss to Book.default_spelling rather than printing the lookup key itself ("luke.abbr"); pinned in cli.t against a language file with no [bible] section at all, independent of la.ini/en.ini's own eventual [bible] section. Regenerate the 11 golden templates for 2027: every changed line is one canonical citation replacing a stored variant, verified against the full readings 2027 diff (raw vs default) cell by cell -- 86 distinct (raw, rendered) pairs account for the entire diff across all 11 files, with zero unexplained residue. Two families: the seven duplicate book spellings collapsing onto one canonical form (Isa./Isa, 3 Kgs./3 Kings, ...), and citations reconstructed from parsed structure dropping stray punctuation the parser already treats as noise (a trailing period or semicolon, a comma chapter/verse separator, an elided inherited chapter) -- each of the latter already named and tested in test_citation.ml's parse_suite before this task. --- test/test_view.ml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'test/test_view.ml') diff --git a/test/test_view.ml b/test/test_view.ml index 37fb284..b2d302e 100644 --- a/test/test_view.ml +++ b/test/test_view.ml @@ -45,7 +45,8 @@ let default_lang = lazy (Colitur_naming.Lang.with_fallback (read_lang "../lang/en.ini") (read_lang "../lang/la.ini")) let view_of y = - V.of_days ~lang:(Lazy.force default_lang) ~vocab:Rite_ef.Vocab_ef.vocab ~rite:"ef" ~year:y + let lang = Lazy.force default_lang in + V.of_days ~lang ~sigla:(Test_support.default_sigla lang) ~vocab:Rite_ef.Vocab_ef.vocab ~rite:"ef" ~year:y (days_of_year y) let get path v = @@ -180,7 +181,10 @@ let latin () = match Colitur_naming.Lang.of_string s with | Ok t -> t | Error e -> Alcotest.failf "la.ini: %s" e -let view_named y = V.of_days ~lang:(latin ()) ~vocab:Rite_ef.Vocab_ef.vocab ~rite:"ef" ~year:y (days_of_year y) +let view_named y = + let lang = latin () in + V.of_days ~lang ~sigla:(Test_support.default_sigla lang) ~vocab:Rite_ef.Vocab_ef.vocab ~rite:"ef" ~year:y + (days_of_year y) (* The ordo booklet's week header (Hebdomada I (Ian 1-2)): a Roman numeral beside the existing arabic one, and month_num/month_name/month_abbr @@ -256,7 +260,10 @@ let test_no_day_shows_a_slug () = (as_list (get [ "days" ] v)) let test_slug_is_unchanged_by_naming () = - let raw = V.of_days ~lang:Colitur_naming.Lang.raw ~vocab:Rite_ef.Vocab_ef.vocab ~rite:"ef" ~year:2027 (days_of_year 2027) in + let raw = + V.of_days ~lang:Colitur_naming.Lang.raw ~sigla:Colitur_citation.Sigla.verbatim + ~vocab:Rite_ef.Vocab_ef.vocab ~rite:"ef" ~year:2027 (days_of_year 2027) + in let named = view_named 2027 in List.iter2 (fun a b -> Alcotest.(check string) "slug identical" (as_str (get [ "slug" ] a)) (as_str (get [ "slug" ] b))) @@ -264,7 +271,10 @@ let test_slug_is_unchanged_by_naming () = (* Under --raw the name IS the slug: that is what makes raw output byte-stable. *) let test_raw_name_equals_slug () = - let raw = V.of_days ~lang:Colitur_naming.Lang.raw ~vocab:Rite_ef.Vocab_ef.vocab ~rite:"ef" ~year:2027 (days_of_year 2027) in + let raw = + V.of_days ~lang:Colitur_naming.Lang.raw ~sigla:Colitur_citation.Sigla.verbatim + ~vocab:Rite_ef.Vocab_ef.vocab ~rite:"ef" ~year:2027 (days_of_year 2027) + in List.iter (fun d -> Alcotest.(check string) "raw" (as_str (get [ "slug" ] d)) (as_str (get [ "name" ] d))) (as_list (get [ "days" ] raw)) -- cgit v1.3