From 4de7f7dca7485c9a6c94f6f86a53d01a974fce54 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 23 Jul 2026 14:39:31 +0200 Subject: web: HTMX server + lectio-web binary NewServer wires B1's RenderReadings/Themes/themeCSS/embedded static+ templates FS into an http.ServeMux: GET / (full page), GET /readings (HTMX reading-pane fragment), GET /lookup (bible.Lookup passage search fragment), GET /theme.css (theme stylesheet, falling back through cfg.WebTheme to the built-in default on an unknown name), GET /static/. Run listens on cfg.WebPort (0 = OS-picked free port), prints the URL, best-effort opens a browser, then serves. cmd/lectio-web is the binary entry point (config.Load -> web.Run). Fold-in from the B1 review: hardened themeCSS's name guard to an explicit ^[A-Za-z0-9_-]+$ allowlist (the old filepath.Base/ContainsAny check let ".." through), plus guard-rejection and HTML-escaping regression tests -- B2 is what makes /theme.css?name= reachable from the network, so it owns closing this out. --- internal/web/templates/index.html | 72 ++++++++++++++++++++++++++++++++++++++ internal/web/templates/lookup.html | 20 +++++++++++ 2 files changed, 92 insertions(+) create mode 100644 internal/web/templates/index.html create mode 100644 internal/web/templates/lookup.html (limited to 'internal/web/templates') diff --git a/internal/web/templates/index.html b/internal/web/templates/index.html new file mode 100644 index 0000000..4dd580f --- /dev/null +++ b/internal/web/templates/index.html @@ -0,0 +1,72 @@ +{{/* index.html renders the full lectio-web page: top-bar controls (date, + lectionary, version checkboxes, all/gospel toggle, theme select), a + passage-lookup form, and the pre-rendered reading pane (#pane). + + The controls form (#controls) carries hx-get="/readings" and fires on + any "change" bubbling up from its fields (htmx auto-includes an + hx-get element's enclosing form fields as the request's query + params -- no hx-include needed). The date +/- buttons are separate + hx-get elements nested in the same form so their own field values are + included too; they override "date" via hx-vals. The theme + + + + + + {{range .VersionOpts}} + + {{end}} + + + + + + +
+ + +
+
{{.Lookup}}
+ +
{{.Reading}}
+ + + + diff --git a/internal/web/templates/lookup.html b/internal/web/templates/lookup.html new file mode 100644 index 0000000..c8bc2a7 --- /dev/null +++ b/internal/web/templates/lookup.html @@ -0,0 +1,20 @@ +{{/* lookup.html renders the passage-lookup fragment: one .column per + requested version, each version's matched bible.Verse rows plus any + sub-refs the corpus had no entry for. Structurally mirrors + readings.html's .columns/.column/.block classes so theme CSS restyles + both panes the same way. */}} +{{if .}} +
+ {{range .}} +
+

{{.Version}}

+ {{range .Verses}} +

{{.Chapter}}:{{.Verse}} {{.Text}}

+ {{end}} + {{if .Missing}} +

brak: {{range $i, $m := .Missing}}{{if $i}}, {{end}}{{$m}}{{end}}

+ {{end}} +
+ {{end}} +
+{{end}} -- cgit v1.3