diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 19:22:40 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 19:22:40 +0200 |
| commit | d5d175118138249fe7d9e85d1bc65fb0b7e3a398 (patch) | |
| tree | 232c9c709b378acefff08bd7e7d930a7edb861fc /internal/config | |
| parent | a9faf42cfbb1c060ac69f703f0c78616656566cb (diff) | |
| download | lectio-d5d175118138249fe7d9e85d1bc65fb0b7e3a398.tar.gz lectio-d5d175118138249fe7d9e85d1bc65fb0b7e3a398.zip | |
caldata: allow an external universal sanctorale to override the embedded one
The universal calendar of saints can now be refreshed or replaced without a
rebuild: if ~/.config/lectio/sanctorale/of.ini (OF) or ef.ini (EF) is present
and parses, caldata.Base uses it instead of the embedded calendar; a missing or
malformed file falls back to the embedded default, so the binary stays
self-contained and correct out of the box. Local diocesan/national additions
keep layering on top via calendars/ + `use` (unchanged). The temporal cycle and
precedence rules stay in code -- only the sanctorale is data.
- caldata.SetSanctoraleDir hook (mirrors bible/naming/i18n); Base() prefers the
external file per form. config.SanctoraleDir(); wired in the CLI, TUI and web
entry points. Tests cover override, no-file, and malformed-file fallback.
- README: new "Calendar of saints" section (two tiers: overlay via `use`,
replace via sanctorale/<form>.ini); config comment notes the override.
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 08c0b60..0596194 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -49,6 +49,8 @@ const configHeader = `# lectio configuration (INI). Full-line comments only (# o # pager shell command, e.g. less -R; empty = off # use calendar layers to stack over the universal calendar: names of # ~/.config/lectio/calendars/<name>.ini files (comma list, order = precedence) +# (to REPLACE the whole universal calendar instead, drop +# ~/.config/lectio/sanctorale/of.ini or ef.ini -- see the README) # # [calendar] — computed-calendar placement options (defaults = Universal Roman Calendar): # epiphany fixed | sunday (fixed = Jan 6; sunday = the Sunday of Jan 2-8) @@ -360,6 +362,21 @@ func UIDir() (string, error) { return filepath.Join(filepath.Dir(p), "ui"), nil } +// SanctoraleDir is the user directory for an optional external universal +// sanctorale that REPLACES the embedded one: <dir>/of.ini (Ordinary Form) and +// <dir>/ef.ini (Extraordinary Form). It lets the calendar of saints and their +// ranks be refreshed as the Church changes them without rebuilding the binary; +// absent (the default), the embedded, oracle-validated calendar is used. Local +// diocesan/national additions layer ON TOP via calendars/ + `use` (they need no +// full file). Mirrors CalendarsDir. +func SanctoraleDir() (string, error) { + p, _, err := configPath() + if err != nil { + return "", err + } + return filepath.Join(filepath.Dir(p), "sanctorale"), nil +} + // NamesDir is the user directory for drop-in day-name language files // (<code>.ini), alongside calendars/ and corpora/ under the lectio config dir. // A file here overrides the built-in day names for its language key by key; |
