summaryrefslogtreecommitdiff
path: root/bin/main.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 22:40:13 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 22:40:13 +0200
commitf73bd5d0e33146c24af1e98bf9ea26bd8cbf004b (patch)
tree790100dcc0077532d9446478e51d4cd40209c1c6 /bin/main.ml
parent2d8942e08edcbe5430f97270bdb1233e287600ee (diff)
parent671c4264707ec8c81845059746632b00f2481d88 (diff)
downloadcolitur-f73bd5d0e33146c24af1e98bf9ea26bd8cbf004b.tar.gz
colitur-f73bd5d0e33146c24af1e98bf9ea26bd8cbf004b.zip
Merge branch 'robustness-and-hackability'
An audit of the shipped program, plus the fixes it found. The citation parser accepted OCaml integer-literal syntax, so a typo like 'Luke 1_1:5' silently became a different chapter. Four pairs of different books shared a full title -- 1 and 2 Corinthians both rendered 'Epistola ad Corinthios' -- leaving 108 citations in 2027 alone that a reader could not resolve to a book. Spec section 8.5 is now delivered rather than recorded: shipped styles re-parse their own output. Overlay errors no longer name OCaml source files at the reader. Also: the new-overlay scaffold shows citations at the right nesting level, config --show validates before printing, error messages no longer echo whole file lines, and a month answers to both spellings of its own name.
Diffstat (limited to 'bin/main.ml')
-rw-r--r--bin/main.ml31
1 files changed, 28 insertions, 3 deletions
diff --git a/bin/main.ml b/bin/main.ml
index acf8859..b1d9cac 100644
--- a/bin/main.ml
+++ b/bin/main.ml
@@ -1942,6 +1942,20 @@ let lang_check path =
it via [load_lang]). *)
let config_show ~lang_flag ~template_flag ~format_flag ~overlays_flag ~sigla_style_flag ~sigla_book_flag
~sigla_tradition_flag config =
+ (* VALIDATE BEFORE PRINTING ANYTHING. A usage error used to surface
+ halfway down the table, so `config --show --sigla-book bogus` exited 2
+ having already written five rows to stdout -- a caller redirecting
+ stdout to a file got a truncated, plausible-looking report alongside a
+ non-zero status. Nothing is emitted now until every value is known good. *)
+ let sigla_book_check, _ =
+ Colitur_naming.Config.resolve ~flag:sigla_book_flag
+ ~config:(Colitur_naming.Config.sigla_book config) ~default:"abbr"
+ in
+ if sigla_book_check <> "full" && sigla_book_check <> "abbr" then begin
+ Printf.eprintf "colitur: unknown --sigla-book %S (want \"full\" or \"abbr\")\n"
+ sigla_book_check;
+ exit 2
+ end;
let cpath = config_path () in
Printf.printf "config file: %s (%s)\n" cpath
(if cpath <> "" && Sys.file_exists cpath then "exists" else "not found");
@@ -1996,8 +2010,13 @@ let new_overlay_template =
; universal entry -- by naming its slug.
((id my-parish)
(directives
- ; A fixed-date local feast. `citations` and `layer` may be omitted: they
- ; default to empty and to this overlay's own id.
+ ; A fixed-date local feast, with its own Mass readings.
+ ;
+ ; NOTE WHERE `citations` AND `layer` GO: inside `cel`, beside `rank` and
+ ; `colour` -- NOT beside `date`. Both may be omitted, defaulting to no
+ ; readings and to this overlay's own id. This example shows them in
+ ; place because the nesting is the single easiest thing to get wrong,
+ ; and getting it wrong is what `unknown field(s): citations` means.
((Add
((date (Fixed (month 5) (day 20)))
(cel
@@ -2007,7 +2026,13 @@ let new_overlay_template =
; status: Feast | Commemoration_only
; colour: White | Red | Violet | Green | Black | Rose
; subject: Lord | Bvm | Saint | Temporal
- (rank Class3) (status Feast) (colour White) (subject Saint)))))
+ (rank Class3) (status Feast) (colour White) (subject Saint)
+ ; part: First | Gospel. The reference is a citation, never
+ ; scripture text -- colitur ships no Bible.
+ (citations
+ (((part First) (reference "Wis 7:7-14"))
+ ((part Gospel) (reference "Matt 5:13-19"))))
+ (layer my-parish)))))
; A MOVABLE feast: the first Sunday of October. `nth` may be negative to
; count from the end of the month (-1 is the last).
(Add