diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 14:59:14 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 14:59:14 +0200 |
| commit | cb3379f41c06a94085c77fe359709b46712850dc (patch) | |
| tree | 032801111764c83c3ab089ed101ba4d1222a9abd /internal/web/server.go | |
| parent | a13dd6224a095242da54062e4775570c4f16a718 (diff) | |
| download | lectio-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/web/server.go')
| -rw-r--r-- | internal/web/server.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/web/server.go b/internal/web/server.go index a586534..2674802 100644 --- a/internal/web/server.go +++ b/internal/web/server.go @@ -62,7 +62,7 @@ func (s *server) apply(cfg config.Config, tbl *bible.BookTable) { // query parameters; it is never mutated -- /settings applies changes to a // live, mutable copy held by server, which every handler reads per request. func NewServer(cfg config.Config) http.Handler { - tbl, _ := bible.LoadBookTable(config.UserBooksTOML()) + tbl, _ := bible.LoadBookTable(config.UserBooksINI()) s := &server{cfg: cfg, tbl: tbl, bm: bookmarks.Open()} mux := http.NewServeMux() @@ -719,7 +719,7 @@ func themeCSSHandler(cfg config.Config) http.HandlerFunc { // settingsData drives templates/settings.html. type settingsData struct { Cfg config.Config - Books string // current books.toml text (user override, else the embedded default) + Books string // current books.ini text (user override, else the embedded default) ThemeOpts []themeOpt // for the web_theme <select> VersionOpts []versionOpt // all five, Checked if in Cfg.Versions WebVersionOpts []versionOpt // all five, Checked if in Cfg.WebVersions @@ -768,10 +768,10 @@ func newSettingsData(cfg config.Config, books, errMsg string, saved bool) settin } func currentBooksText() string { - if b := config.UserBooksTOML(); len(b) > 0 { + if b := config.UserBooksINI(); len(b) > 0 { return string(b) } - return string(bible.DefaultBooksTOML()) + return string(bible.DefaultBooksINI()) } // settingsGet renders the settings form for the live config. @@ -785,7 +785,7 @@ func settingsGet(s *server) http.HandlerFunc { } } -// settingsPost validates and persists the submitted settings + books.toml, then +// settingsPost validates and persists the submitted settings + books.ini, then // applies them to the running server and redirects (PRG). On a validation error // it re-renders the form with the message and the user's edits, HTTP 200. func settingsPost(s *server) http.HandlerFunc { @@ -819,12 +819,12 @@ func settingsPost(s *server) http.HandlerFunc { renderSettingsError(w, cfg, booksText, err.Error()) return } - // Validate books.toml (parse via the same loader the app uses). + // Validate books.ini (parse via the same loader the app uses). var newTbl *bible.BookTable if strings.TrimSpace(booksText) != "" { t, berr := bible.LoadBookTable([]byte(booksText)) if berr != nil { - renderSettingsError(w, cfg, booksText, "books.toml: "+berr.Error()) + renderSettingsError(w, cfg, booksText, "books.ini: "+berr.Error()) return } newTbl = t @@ -835,7 +835,7 @@ func settingsPost(s *server) http.HandlerFunc { renderSettingsError(w, cfg, booksText, "saving config: "+err.Error()) return } - // Only write books.toml when the editor actually carried content, so a + // Only write books.ini when the editor actually carried content, so a // submit with an empty/absent books field never clobbers an existing // override (the form always pre-fills the textarea). if strings.TrimSpace(booksText) != "" { |
