From 87fd0ad3e9309064fe9fda373035f5ce127ae8d8 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sun, 26 Apr 2020 00:21:47 +0200 Subject: Improved HTML template --- internal/feed/template/feed.tpl.go | 11 +++++++---- internal/feed/template/template.go | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'internal/feed/template') diff --git a/internal/feed/template/feed.tpl.go b/internal/feed/template/feed.tpl.go index bb49818..8aab9d7 100644 --- a/internal/feed/template/feed.tpl.go +++ b/internal/feed/template/feed.tpl.go @@ -40,14 +40,15 @@ const feedTpl = `{{- /*gotype:github.com/Necoro/feed2imap-go/internal/feed.feedi -{{with .Item.Description}} +{{with .Item.Content}}
{{html .}} -{{end}} -{{with .Item.Content}} +{{else}} +{{with .Item.Description}}
{{html .}} {{end}} +{{end}} {{with .Item.Enclosures}} @@ -71,6 +72,8 @@ const feedTpl = `{{- /*gotype:github.com/Necoro/feed2imap-go/internal/feed.feedi
{{template "bottomLine" (dict "descr" "Date:" "content" .Item.Published)}} {{template "bottomLine" (dict "descr" "Author:" "content" .Creator)}} - {{template "bottomLine" (dict "descr" "Subject:" "content" .Item.Title)}} {{template "bottomLine" (dict "descr" "Filed under:" "content" (join ", " .Item.Categories))}} + {{with .Feed.FeedLink}} + {{template "bottomLine" (dict "descr" "Feed-Link:" "content" (print "" . "" | html))}} + {{end}}
` diff --git a/internal/feed/template/template.go b/internal/feed/template/template.go index 7871e06..4c7b636 100644 --- a/internal/feed/template/template.go +++ b/internal/feed/template/template.go @@ -9,11 +9,11 @@ import ( "github.com/Necoro/feed2imap-go/pkg/log" ) -func dict(v ...string) map[string]string { - dict := map[string]string{} +func dict(v ...interface{}) map[string]interface{} { + dict := make(map[string]interface{}) lenv := len(v) for i := 0; i < lenv; i += 2 { - key := v[i] + key := v[i].(string) if i+1 >= lenv { dict[key] = "" continue -- cgit v1.2.3-54-g00ecf