index.tml to namespan

main
bel 2025-05-04 11:36:56 -06:00
parent f2e828a9eb
commit dbfd33f55e
2 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,11 @@
<html>
<header>
<link rel="stylesheet" href="/experimental/ui/dark.css">
<script>
fill(elem) {
}
</script>
</header>
<body>
<h2>Feeds</h2>
@ -8,7 +13,7 @@
<div>
{{ range feeds }}
<div>
<h4>{{ .Version.URL }}</h4>
<h4>(<button onclick="fill(this)">{{ namespan "entry.id" .Entry.ID}}</button>) {{ namespan "version.url" .Version.URL }}</h4>
<div>{{ .Version.Created }} (last {{ .Execution.Executed }})</div>
<div>@{{ .Version.Cron }} ~"{{ .Version.Pattern }}"</div>
<div>{{ .Version.WebhookMethod }} {{ .Version.WebhookURL }} | {{ .Version.WebhookBody }}</div>

View File

@ -2,12 +2,13 @@ package handler
import (
"encoding/json"
"html/template"
"fmt"
"net/http"
"os"
"path"
"show-rss/src/feeds"
"slices"
"text/template"
)
var dir = func() string {
@ -51,6 +52,9 @@ func (h Handler) uiIndex(w http.ResponseWriter, r *http.Request) error {
slices.Sort(ks)
return ks
},
"namespan": func(k string, v any) string {
return fmt.Sprintf("<span name=%q>%s</span>", k, v)
},
})
tmpl, err := tmpl.Parse(string(b))