diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-12 14:52:02 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-12 14:52:02 +0200 |
| commit | ef171295a5d7b7cc40ad7367e142de4234a4eb54 (patch) | |
| tree | ded48e5474152ee0cbf542658e2d94a146c01125 | |
| parent | 96b14d17e5210b93f1c126fe165fd81ec1e839af (diff) | |
| download | lectio-ef171295a5d7b7cc40ad7367e142de4234a4eb54.tar.gz lectio-ef171295a5d7b7cc40ad7367e142de4234a4eb54.zip | |
lectio-ef-dump: add name_en/name_pl columns
The verification instrument this task's own diff comparisons run
against emitted season/week/slug/rank/colour but no display name at
all, so it was structurally incapable of seeing the 322-line name.pl
deletion (fix round 2) -- the season/rank/colour columns it already
printed were all still correct, since name is a wholly separate field
naming.CelebrationName reads independently, and no diff against this
tool's own prior output could ever have caught the regression.
Appends two fixed columns after colour (before the existing +other
tokens): the observed celebration's own name.en and name.pl (spaces
replaced with "_" so the line stays whitespace-delimited; "-" for an
empty name, matching the week column's own convention). Format is
documented in the package doc comment as a departure from colitur's
matching day-line format: a straight diff against colitur's output
must now ignore these two trailing-before-others fields.
| -rw-r--r-- | cmd/lectio-ef-dump/main.go | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/cmd/lectio-ef-dump/main.go b/cmd/lectio-ef-dump/main.go index 08ff547..e7d014a 100644 --- a/cmd/lectio-ef-dump/main.go +++ b/cmd/lectio-ef-dump/main.go @@ -1,10 +1,25 @@ // Command lectio-ef-dump prints lectio's Extraordinary Form (1962) calendar, // one line per day, for use as colitur's differential oracle. // -// Output format matches colitur's `colitur day <year>` line for line (see -// colitur's bin/main.ml, day_line), so the two streams are diffable directly: +// Output format is colitur's `colitur day <year>` line, PLUS two display-name +// columns colitur's own line does not carry (so a straight `diff` against +// colitur's output must ignore trailing fields, not compare them line for +// line): // -// YYYY-MM-DD weekday season week slug rank colour [+other-slug]... +// YYYY-MM-DD weekday season week slug rank colour name_en name_pl [+other-slug]... +// +// name_en and name_pl are the observed celebration's own display name in +// English and Polish (Celebration.Name["en"]/["pl"]), spaces replaced with +// "_" so the line stays whitespace-delimited; "-" where the name is empty +// (a bare feria with no proper name). Added after a regeneration of +// internal/caldata/tridentine-calendar.ini once deleted all 322 Polish +// names (name.pl 322 -> 0) with nothing in this repository's test suite OR +// this dumper noticing: the season/rank/colour columns this tool already +// printed were all still correct, since name is a wholly separate field +// naming.CelebrationName reads independently. This dumper is what the +// task's own before/after diff verification is run against, so it needed +// to be structurally capable of seeing a name regression, not just told to +// look harder next time. // // Every column carries lectio's OWN vocabulary (season names, slugs, rank and // colour spellings) -- this dumper does not translate lectio's values into @@ -79,17 +94,30 @@ func run(args []string, stdout, stderr io.Writer) int { return 0 } -// dumpLine renders one LiturgicalDay as a colitur-format line. Week is -// lectio's own int (0 where no season week applies, e.g. named I class feasts -// and per annum green-season ferias); printed as "-" there so the field count -// stays fixed, matching colitur's own convention for an absent week. +// dumpName renders a display-name field: spaces become "_" so the line stays +// whitespace-delimited (names routinely contain spaces, e.g. "St. Thomas +// Becket", "Wniebowzięcie N. M. P."); "-" for an empty name, matching the +// week column's own convention for "absent". +func dumpName(s string) string { + if s == "" { + return "-" + } + return strings.ReplaceAll(s, " ", "_") +} + +// dumpLine renders one LiturgicalDay as a colitur-format line, plus the +// name_en/name_pl columns colitur's own line does not carry (see this +// package's doc comment). Week is lectio's own int (0 where no season week +// applies, e.g. named I class feasts and per annum green-season ferias); +// printed as "-" there so the field count stays fixed, matching colitur's +// own convention for an absent week. func dumpLine(day calendar.LiturgicalDay) string { week := "-" if day.Week != 0 { week = strconv.Itoa(day.Week) } var b strings.Builder - fmt.Fprintf(&b, "%s %s %s %s %s %s %s", + fmt.Fprintf(&b, "%s %s %s %s %s %s %s %s %s", day.Date.Format("2006-01-02"), strings.ToLower(day.Weekday.String()), string(day.Season), @@ -97,6 +125,8 @@ func dumpLine(day calendar.LiturgicalDay) string { day.Observed.Slug, string(day.Observed.Rank), string(day.Colour), + dumpName(day.Observed.Name["en"]), + dumpName(day.Observed.Name["pl"]), ) for _, o := range day.Others { fmt.Fprintf(&b, " +%s", o.Slug) |
