aboutsummaryrefslogtreecommitdiff
path: root/internal/cli/liturgy.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 14:59:14 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 14:59:14 +0200
commitcb3379f41c06a94085c77fe359709b46712850dc (patch)
tree032801111764c83c3ab089ed101ba4d1222a9abd /internal/cli/liturgy.go
parenta13dd6224a095242da54062e4775570c4f16a718 (diff)
downloadlectio-cb3379f41c06a94085c77fe359709b46712850dc.tar.gz
lectio-cb3379f41c06a94085c77fe359709b46712850dc.zip
feat: books.toml -> books.ini, multi-language (add Latin dialect), config-scoped citation display
books.ini with [en]/[pl]/[la]; parseBooks reads INI (bible drops go-toml). Latin dialect resolves EF citations (Eccli->Sirach, Apoc->Revelation, Luc...); sigla_style gains 'latin'. Reading citations now DISPLAY in the configured sigla (FormatRef(SiglaLang)), not raw English. One-shot books.toml->books.ini user migration (go-toml now config-only). Web settings editor -> books.ini.
Diffstat (limited to 'internal/cli/liturgy.go')
-rw-r--r--internal/cli/liturgy.go21
1 files changed, 13 insertions, 8 deletions
diff --git a/internal/cli/liturgy.go b/internal/cli/liturgy.go
index fc3efae..840e9a6 100644
--- a/internal/cli/liturgy.go
+++ b/internal/cli/liturgy.go
@@ -31,7 +31,7 @@ func runLiturgy(cfg config.Config, date string, stdout, stderr io.Writer) int {
fmt.Fprintln(stderr, "lectio: warning:", e)
}
day := calendar.Compute(d.UTC(), cfg.Selection(), layers)
- tbl, _ := bible.LoadBookTable(userBooksTOML())
+ tbl, _ := bible.LoadBookTable(userBooksINI())
printLiturgicalDay(stdout, cfg, tbl, day)
return 0
}
@@ -45,19 +45,23 @@ func vernacularVersion(cfg config.Config) string {
return "drb"
}
-// readingText resolves an English citation and returns its text from version,
-// or "" if it does not resolve.
-func readingText(tbl *bible.BookTable, version, citation string) string {
+// readingLine resolves an English-authored citation and returns (display,
+// text): display is the citation re-formatted in the user's configured sigla
+// dialect (SiglaLang); text is the verses from version (or "" if unresolved).
+// The reading data is authored in English, so it is parsed in the "en" dialect;
+// only the display honors the configured dialect's abbreviations.
+func readingLine(tbl *bible.BookTable, cfg config.Config, version, citation string) (string, string) {
engRef, ok := tbl.ParseRef("en", citation)
if !ok {
- return ""
+ return citation, "" // unparseable: show as authored
}
+ display := tbl.FormatRef(cfg.SiglaLang(), engRef)
vs, _ := bible.Lookup(version, engRef)
parts := make([]string, 0, len(vs))
for _, v := range vs {
parts = append(parts, strings.TrimSpace(v.Text))
}
- return strings.Join(parts, " ")
+ return display, strings.Join(parts, " ")
}
func printLiturgicalDay(out io.Writer, cfg config.Config, tbl *bible.BookTable, day calendar.LiturgicalDay) {
@@ -81,8 +85,9 @@ func printLiturgicalDay(out io.Writer, cfg config.Config, tbl *bible.BookTable,
if m.Variant != "" {
label = m.Variant + " " + label
}
- fmt.Fprintf(out, "\n %s (%s):\n", label, r.Citation)
- if txt := readingText(tbl, vern, r.Citation); txt != "" {
+ disp, txt := readingLine(tbl, cfg, vern, r.Citation)
+ fmt.Fprintf(out, "\n %s (%s):\n", label, disp)
+ if txt != "" {
for _, line := range strings.Split(render.Wrap(txt, 72), "\n") {
fmt.Fprintf(out, " %s\n", line)
}