From b41368462c89dbfc5230350c46629266f03ad9d5 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Tue, 16 Feb 2021 19:24:33 +0100 Subject: Use go-embed for templates instead of inline strings. They should also use CRLF (cf issue #46). --- internal/feed/template/template.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'internal/feed/template/template.go') diff --git a/internal/feed/template/template.go b/internal/feed/template/template.go index d8eb850..09dacf1 100644 --- a/internal/feed/template/template.go +++ b/internal/feed/template/template.go @@ -15,6 +15,15 @@ type Template interface { Execute(wr io.Writer, data interface{}) error } +//go:embed html.tpl +var htmlTpl string + +//go:embed text.tpl +var textTpl string + +var Html = fromString("Feed", htmlTpl, true) +var Text = fromString("Feed", textTpl, false) + func must(t Template, err error) Template { if err != nil { panic(err) -- cgit v1.2.3-54-g00ecf From 2df7f561b6a4977051499731740aae2138c9d001 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 18 Feb 2021 09:47:23 +0100 Subject: Import 'embed' package --- internal/feed/template/template.go | 1 + 1 file changed, 1 insertion(+) (limited to 'internal/feed/template/template.go') diff --git a/internal/feed/template/template.go b/internal/feed/template/template.go index 09dacf1..9804190 100644 --- a/internal/feed/template/template.go +++ b/internal/feed/template/template.go @@ -1,6 +1,7 @@ package template import ( + _ "embed" "fmt" html "html/template" "io" -- cgit v1.2.3-54-g00ecf