diff options
Diffstat (limited to 'internal/template')
-rw-r--r-- | internal/template/feed.tpl.go | 6 | ||||
-rw-r--r-- | internal/template/template.go | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/internal/template/feed.tpl.go b/internal/template/feed.tpl.go index f6862d5..2bf07f3 100644 --- a/internal/template/feed.tpl.go +++ b/internal/template/feed.tpl.go @@ -40,9 +40,13 @@ const feedTpl = `{{- /*gotype:github.com/Necoro/feed2imap-go/internal/feed.feedi </td> </tr> </table> +{{with .Item.Description}} + <br /> <!-- originally: only if content and 'content !~ /\A\s*</m' --> + {{html .}} +{{end}} {{with .Item.Content}} <br /> <!-- originally: only if content and 'content !~ /\A\s*</m' --> - {{.}} + {{html .}} {{end}} {{with .Item.Enclosures}} <table border="1" width="100%" cellpadding="0" cellspacing="0" style="border-spacing: 0; "> diff --git a/internal/template/template.go b/internal/template/template.go index 350a0ed..a239484 100644 --- a/internal/template/template.go +++ b/internal/template/template.go @@ -24,7 +24,7 @@ func join(sep string, parts []string) string { return strings.Join(parts, sep) } -func LastUrlPart(url string) string { +func lastUrlPart(url string) string { split := strings.Split(url, "/") return split[len(split)-1] } @@ -42,11 +42,16 @@ func byteCount(b int64) string { return fmt.Sprintf("%.1f %cB", float64(b)/float64(div), "KMGTPE"[exp]) } +func html(s string) template.HTML { + return template.HTML(s) +} + var funcMap = template.FuncMap{ "dict": dict, "join": join, - "lastUrlPart": LastUrlPart, + "lastUrlPart": lastUrlPart, "byteCount": byteCount, + "html": html, } func fromString(name, templateStr string) *template.Template { |