diff --git a/main.go b/main.go index bcf00f5..455744f 100644 --- a/main.go +++ b/main.go @@ -20,9 +20,14 @@ import ( "p83.nl/go/ekster/pkg/jf2" ) +type Summary struct { + Items []microsub.Item +} + func init() { log.SetFlags(log.LstdFlags | log.Lshortfile) } + func main() { u, err := url.Parse(os.Args[1]) if err != nil { @@ -52,7 +57,9 @@ func main() { items = filterEntriesAfter(items, now.With(time.Now()).Monday()) - err = outputEntries(items, &buf) + summary := Summary{Items: items} + + err = outputEntries(summary, &buf) if err != nil { log.Fatal(err) } @@ -93,12 +100,12 @@ func openAndCreate(filename string) (io.ReadCloser, error) { return f, nil } -func outputEntries(items []microsub.Item, w io.Writer) error { +func outputEntries(summary Summary, w io.Writer) error { t, err := template.ParseFiles("templates/weekly.html") if err != nil { log.Fatal(err) } - err = t.Execute(w, items) + err = t.Execute(w, summary) if err != nil { return err } diff --git a/templates/weekly.html b/templates/weekly.html index dd1d14d..f7a2962 100644 --- a/templates/weekly.html +++ b/templates/weekly.html @@ -1,6 +1,6 @@
- {{ range . }} + {{ range .Items }}

{{ .Name }}

{{ if .Content }} {{ if .Content.HTML }}