aboutsummaryrefslogtreecommitdiff
path: root/bin/main.ml
diff options
context:
space:
mode:
Diffstat (limited to 'bin/main.ml')
-rw-r--r--bin/main.ml31
1 files changed, 30 insertions, 1 deletions
diff --git a/bin/main.ml b/bin/main.ml
index c76a082..1207b1d 100644
--- a/bin/main.ml
+++ b/bin/main.ml
@@ -780,7 +780,11 @@ let load_sigla ~raw ~lang_t ~sigla_style_flag ~sigla_book_flag ~sigla_tradition_
in
let sigla_book_value, _ =
Colitur_naming.Config.resolve ~flag:sigla_book_flag
- ~config:(Colitur_naming.Config.sigla_book config) ~default:"abbr"
+ ~config:(Colitur_naming.Config.sigla_book config)
+ (* The STYLE's own [book] key is the default, so a style file can
+ set it and a flag/config still overrides. A hardcoded "abbr"
+ here made the documented [sigla] book key unreachable. *)
+ ~default:(Colitur_citation.Render.book_string style)
in
let book_form =
match sigla_book_value with
@@ -1870,11 +1874,36 @@ let lang_check path =
in
let missing = List.filter (fun s -> not (List.mem s have)) known in
let unknown = List.filter (fun s -> not (List.mem s known)) have in
+ (* Book names are checked the same way, and separately. Without
+ this the reference set gained a [bible] half that nothing ever
+ consulted: a file with [bible] entirely absent reported a clean
+ bill of health while every citation silently fell back to the
+ data's own Latin spelling. A miss is the TOTAL-lookup contract's
+ own signature -- [Lang.bible] returns the KEY when there is no
+ entry -- so equality with the key IS the test. *)
+ let missing_books =
+ List.concat_map
+ (fun id ->
+ let n = Colitur_citation.Book.to_string id in
+ List.filter_map
+ (fun form ->
+ let key = n ^ "." ^ form in
+ if Colitur_naming.Lang.bible t key = key then Some key
+ else None)
+ [ "full"; "abbr" ])
+ Colitur_citation.Book.all
+ in
List.iter (fun s -> Printf.printf "missing: %s\n" s) (List.sort compare missing);
+ List.iter (fun s -> Printf.printf "missing book: %s\n" s)
+ (List.sort compare missing_books);
List.iter (fun s -> Printf.printf "unknown slug: %s\n" s) (List.sort compare unknown);
+ let books_total = 2 * List.length Colitur_citation.Book.all in
Printf.printf "%s: %d of %d celebrations named, %d missing, %d unknown\n" path
(List.length known - List.length missing)
(List.length known) (List.length missing) (List.length unknown);
+ Printf.printf "%s: %d of %d book names, %d missing\n" path
+ (books_total - List.length missing_books) books_total
+ (List.length missing_books);
if unknown <> [] then exit 1)
(* `colitur config --show` -- each effective setting, its resolved value,