From 055deaedd6bc1acb770bd96b7da8f985ab0f4f0b Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Fri, 21 Aug 2026 12:19:43 +0200 Subject: 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. --- bin/main.ml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'bin/main.ml') 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" ] -> ( -- cgit v1.3