summaryrefslogtreecommitdiff
path: root/bin/main.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-21 12:19:43 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-21 12:19:43 +0200
commit055deaedd6bc1acb770bd96b7da8f985ab0f4f0b (patch)
tree6b453cd7a8fcaa7f8e4e257fa46c6a720778e8f4 /bin/main.ml
parentaaf3dc5ba55d46b6b318bb761305013f4c533b26 (diff)
downloadcolitur-055deaedd6bc1acb770bd96b7da8f985ab0f4f0b.tar.gz
colitur-055deaedd6bc1acb770bd96b7da8f985ab0f4f0b.zip
feat(config): flavour is settable, and an INI overlay is diagnosed
The escaping flavour was the one rendering setting with no config key, so a template whose extension says nothing needed the flag every run. Unset still means infer, which config --show reports as (infer) rather than (none). Backfills the 0.8.0 and 0.9.0 changelog entries. Both were tagged by hand rather than through 'make release', which is precisely the guard that would have refused a release with no changelog line.
Diffstat (limited to 'bin/main.ml')
-rw-r--r--bin/main.ml20
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/main.ml b/bin/main.ml
index c915255..a7120ad 100644
--- a/bin/main.ml
+++ b/bin/main.ml
@@ -1974,8 +1974,8 @@ let lang_check path =
language code or path, not a closed set, and [config --show] does not
validate [lang] either (that only happens when a command actually loads
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 =
+let config_show ~lang_flag ~template_flag ~format_flag ~flavour_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
@@ -2001,6 +2001,9 @@ let config_show ~lang_flag ~template_flag ~format_flag ~overlays_flag ~sigla_sty
let lang_value = scalar "lang" lang_flag (Colitur_naming.Config.lang config) "la" in
let _ = scalar "template" template_flag (Colitur_naming.Config.template config) "(none)" in
let _ = scalar "format" format_flag (Colitur_naming.Config.format config) "(none)" in
+ (* "(infer)" rather than "(none)": an unset flavour is not an absence, it
+ means the flavour comes from the template's own extension. *)
+ let _ = scalar "flavour" flavour_flag (Colitur_naming.Config.flavour config) "(infer)" in
(* Default is the resolved LANGUAGE, not a literal "la": a booklet that
asked for --lang fr and named no --sigla-style of its own gets French
citations too, not a silent switch back to Latin punctuation. *)
@@ -2244,7 +2247,8 @@ let () =
Printf.eprintf "colitur: config requires --show\n";
exit 2
end;
- config_show ~lang_flag:lang ~template_flag:template ~format_flag:format ~overlays_flag:overlays
+ config_show ~lang_flag:lang ~template_flag:template ~format_flag:format
+ ~flavour_flag:flavour ~overlays_flag:overlays
~sigla_style_flag:sigla_style ~sigla_book_flag:sigla_book ~sigla_tradition_flag:sigla_tradition
config
| [ "day"; ys ] ->
@@ -2308,7 +2312,15 @@ let () =
~sigla_tradition_flag:sigla_tradition ~config
in
with_year ys (fun y ->
- table_report ~lang:lang_t ~sigla ~template ~flavour_opt:flavour
+ table_report ~lang:lang_t ~sigla ~template
+ (* flag > config > infer from the template's own
+ extension. None here still means "infer", which is
+ the usual case, so this is an option-or rather than
+ a Config.resolve with a default. *)
+ ~flavour_opt:
+ (match flavour with
+ | Some _ -> flavour
+ | None -> Colitur_naming.Config.flavour config)
~overlays:effective_overlays y)
))
| [ "publish" ] -> (