Wrap Items in Summary struct
This commit is contained in:
parent
44a5534208
commit
9e8777b66c
13
main.go
13
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
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<span class="next-entry"></span>
|
||||
<div class="h-entry">
|
||||
{{ range . }}
|
||||
{{ range .Items }}
|
||||
<h2 class="p-name">{{ .Name }}</h2>
|
||||
{{ if .Content }}
|
||||
{{ if .Content.HTML }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user