aboutsummaryrefslogtreecommitdiff
path: root/internal/cli/liturgy.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 14:02:49 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 14:02:49 +0200
commit78825639eab3c84d84a60fbd1f1781bcfa332044 (patch)
tree75135a3e67d263a048470198e12e4573dc59e63a /internal/cli/liturgy.go
parent58b748340059a02e696f6a7168f81114ac0f99e9 (diff)
downloadlectio-78825639eab3c84d84a60fbd1f1781bcfa332044.tar.gz
lectio-78825639eab3c84d84a60fbd1f1781bcfa332044.zip
feat(caldata,cli): embed 1962 EF calendar + form-aware Stack; --liturgy computes EF
caldata.Tridentine()/Base(form); Stack(form,dir,use); runLiturgy drops the EF guard and uses the form's base; rankLabel shows I-IV class; display omits OF cycles + strips ef- slug prefix for EF.
Diffstat (limited to 'internal/cli/liturgy.go')
-rw-r--r--internal/cli/liturgy.go30
1 files changed, 18 insertions, 12 deletions
diff --git a/internal/cli/liturgy.go b/internal/cli/liturgy.go
index 24052ab..b1a8874 100644
--- a/internal/cli/liturgy.go
+++ b/internal/cli/liturgy.go
@@ -23,16 +23,8 @@ func runLiturgy(cfg config.Config, date string, stdout, stderr io.Writer) int {
fmt.Fprintf(stderr, "lectio: bad date %q (want YYYY-MM-DD)\n", date)
return 2
}
- // The computed engine currently does the Ordinary Form only. Rather than
- // silently return OF for a traditional (EF) config, say so.
- if cfg.Selection().Form == "old" {
- fmt.Fprintln(stderr, "lectio: the offline calendar engine currently computes only the Ordinary Form.")
- fmt.Fprintln(stderr, " Traditional (1962 EF) computation is not built yet; your traditional daily")
- fmt.Fprintln(stderr, " readings still work via 'lectio [DATE]'. To compute the OF: add --lectionary new.")
- return 1
- }
dir, _ := config.CalendarsDir()
- layers, errs := caldata.Stack(dir, cfg.Use)
+ layers, errs := caldata.Stack(cfg.Selection().Form, dir, cfg.Use)
for _, e := range errs {
fmt.Fprintln(stderr, "lectio: warning:", e)
}
@@ -43,8 +35,12 @@ func runLiturgy(cfg config.Config, date string, stdout, stderr io.Writer) int {
func printLiturgicalDay(out io.Writer, cfg config.Config, day calendar.LiturgicalDay) {
fmt.Fprintf(out, "%s %s\n", day.Date.Format("2006-01-02"), day.Weekday.String())
- fmt.Fprintf(out, "season: %s (week %d · Sunday cycle %s · weekday cycle %s)\n",
- day.Season, day.Week, day.SundayCycle, day.WeekdayCycle)
+ if day.SundayCycle != "" { // OF carries the reading cycles; EF does not
+ fmt.Fprintf(out, "season: %s (week %d · Sunday cycle %s · weekday cycle %s)\n",
+ day.Season, day.Week, day.SundayCycle, day.WeekdayCycle)
+ } else {
+ fmt.Fprintf(out, "season: %s (week %d)\n", day.Season, day.Week)
+ }
fmt.Fprintf(out, "observed: %s [%s · %s]\n", celebrationName(cfg, day.Observed), rankLabel(day.Observed.Rank), day.Colour)
for _, o := range day.Others {
if n := celebrationName(cfg, o); n != "" {
@@ -78,7 +74,7 @@ func celebrationName(cfg config.Config, c calendar.Celebration) string {
if c.Slug == "" {
return "(feria)"
}
- return strings.ReplaceAll(c.Slug, "-", " ")
+ return strings.ReplaceAll(strings.TrimPrefix(c.Slug, "ef-"), "-", " ")
}
func rankLabel(r calendar.Rank) string {
@@ -91,6 +87,16 @@ func rankLabel(r calendar.Rank) string {
return "memorial"
case calendar.RankOptional:
return "optional memorial"
+ case calendar.RankClass1:
+ return "I class"
+ case calendar.RankClass2:
+ return "II class"
+ case calendar.RankClass3:
+ return "III class"
+ case calendar.RankClass4:
+ return "IV class"
+ case calendar.RankCommemoration:
+ return "commemoration"
default:
return "feria"
}