From 671c4264707ec8c81845059746632b00f2481d88 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 20 Aug 2026 22:33:07 +0200 Subject: fix(render): a month answers to both spellings of its own name A week object carries month_name/month_num/month_abbr, because at that level a bare `name` would be ambiguous. An author who learned those names inside {{#weeks}} reaches for them one level up inside {{#months}} too -- where they resolved to nothing, and an unknown key renders as the empty string by design, so the result was a silently blank month heading rather than any error. Found by writing a template from scratch rather than copying a shipped one; every shipped template sidesteps it, which is why nothing caught it. The aliases are additive, so no existing template or golden changes. colitur-templates(5) now documents both spellings and says why they exist. --- lib/render/view.ml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib/render/view.ml') diff --git a/lib/render/view.ml b/lib/render/view.ml index 0691ffb..67dfa70 100644 --- a/lib/render/view.ml +++ b/lib/render/view.ml @@ -267,8 +267,20 @@ let of_days ~lang ~sigla ~vocab ~rite ~year days = let month_name = Lang.month lang m in let month_abbr = Lang.month_abbr lang m in T.Obj - [ ("num", str month_num); + [ (* A month carries its own name under BOTH spellings. The week + objects nested below expose [month_name]/[month_num]/ + [month_abbr], and a template author who learned those names + there naturally reaches for them one level up -- where, before + this, they resolved to nothing and rendered as the empty + string, because an unknown key is silently empty by design. + A month is the only scope where the short forms are + unambiguous, so they stay as the primary names and the + qualified forms are aliases. *) + ("num", str month_num); ("name", str month_name); + ("month_num", str month_num); + ("month_name", str month_name); + ("month_abbr", str month_abbr); ("days", T.List day_values); ("weeks", T.List (weeks_of_month ~first_dow ~month_num ~month_name ~month_abbr day_values)) ]) in -- cgit v1.3