From 3fb920705fe13e30c791bad030da17ba84e4ee0a Mon Sep 17 00:00:00 2001 From: RenĂ© 'Necoro' Neumann Date: Sun, 10 May 2020 15:57:33 +0200 Subject: Renamed feed template to html template --- internal/feed/mail.go | 2 +- internal/feed/template/feed.tpl.go | 63 -------------------------------------- internal/feed/template/html.tpl.go | 63 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 internal/feed/template/feed.tpl.go create mode 100644 internal/feed/template/html.tpl.go diff --git a/internal/feed/mail.go b/internal/feed/mail.go index ecd21ef..b70ce7d 100644 --- a/internal/feed/mail.go +++ b/internal/feed/mail.go @@ -49,7 +49,7 @@ func (item *item) toAddress() []*mail.Address { } func (item *item) writeHtml(writer io.Writer) error { - return template.Feed.Execute(writer, item) + return template.Html.Execute(writer, item) } func (item *item) buildHeader() message.Header { diff --git a/internal/feed/template/feed.tpl.go b/internal/feed/template/feed.tpl.go deleted file mode 100644 index 10f870b..0000000 --- a/internal/feed/template/feed.tpl.go +++ /dev/null @@ -1,63 +0,0 @@ -package template - -var Feed = fromString("Feed", feedTpl) - -//noinspection HtmlDeprecatedAttribute,HtmlUnknownTarget -const feedTpl = `{{- /*gotype:github.com/Necoro/feed2imap-go/internal/feed.feeditem*/ -}} -{{define "bottomLine"}} - {{if .content}} - - - {{.descr}}   - - - {{.content}} - - - {{end}} -{{end}} - - - - - - - - - -
Feed - {{with .Feed.Link}}{{end}} - {{or .Feed.Title .Feed.Link "Unnammed feed"}} - {{if .Feed.Link}}{{end}} -
Item - {{with .Item.Link}}{{end}} - {{or .Item.Title .Item.Link}} - {{if .Item.Link}}{{end}} -
-{{with .Body}} - {{html .}} -{{end}} -{{with .Item.Enclosures}} - - - - - {{range .}} - - - - {{end}} -
Files:
-     - {{.URL | lastUrlPart}} ({{with .Length}}{{. | byteCount}}, {{end}}{{.Type}}) -
-{{end}} -
- - {{template "bottomLine" (dict "descr" "Date:" "content" .Date)}} - {{template "bottomLine" (dict "descr" "Author:" "content" .Creator)}} - {{template "bottomLine" (dict "descr" "Filed under:" "content" (join ", " .Categories))}} - {{with .FeedLink}} - {{template "bottomLine" (dict "descr" "Feed-Link:" "content" (print "" . "" | html))}} - {{end}} -
` diff --git a/internal/feed/template/html.tpl.go b/internal/feed/template/html.tpl.go new file mode 100644 index 0000000..4626188 --- /dev/null +++ b/internal/feed/template/html.tpl.go @@ -0,0 +1,63 @@ +package template + +var Html = fromString("Feed", feedTpl) + +//noinspection HtmlDeprecatedAttribute,HtmlUnknownTarget +const feedTpl = `{{- /*gotype:github.com/Necoro/feed2imap-go/internal/feed.feeditem*/ -}} +{{define "bottomLine"}} + {{if .content}} + + + {{.descr}}   + + + {{.content}} + + + {{end}} +{{end}} + + + + + + + + + +
Feed + {{with .Feed.Link}}{{end}} + {{or .Feed.Title .Feed.Link "Unnammed feed"}} + {{if .Feed.Link}}{{end}} +
Item + {{with .Item.Link}}{{end}} + {{or .Item.Title .Item.Link}} + {{if .Item.Link}}{{end}} +
+{{with .Body}} + {{html .}} +{{end}} +{{with .Item.Enclosures}} + + + + + {{range .}} + + + + {{end}} +
Files:
+     + {{.URL | lastUrlPart}} ({{with .Length}}{{. | byteCount}}, {{end}}{{.Type}}) +
+{{end}} +
+ + {{template "bottomLine" (dict "descr" "Date:" "content" .Date)}} + {{template "bottomLine" (dict "descr" "Author:" "content" .Creator)}} + {{template "bottomLine" (dict "descr" "Filed under:" "content" (join ", " .Categories))}} + {{with .FeedLink}} + {{template "bottomLine" (dict "descr" "Feed-Link:" "content" (print "" . "" | html))}} + {{end}} +
` -- cgit v1.2.3-54-g00ecf