diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 22:33:07 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 22:33:07 +0200 |
| commit | 671c4264707ec8c81845059746632b00f2481d88 (patch) | |
| tree | 790100dcc0077532d9446478e51d4cd40209c1c6 /lib | |
| parent | 1988d350242b47aa52aa07904c495e7e2c0eba82 (diff) | |
| download | colitur-671c4264707ec8c81845059746632b00f2481d88.tar.gz colitur-671c4264707ec8c81845059746632b00f2481d88.zip | |
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.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/render/view.ml | 14 |
1 files changed, 13 insertions, 1 deletions
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 |
