From ffa26298c95451639a6e01db6692d02d50b3d518 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 18 May 2024 16:45:28 +0200 Subject: Remove most custom template functions from html templating --- src/http/tpl.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'src/http/tpl.go') diff --git a/src/http/tpl.go b/src/http/tpl.go index afd4c8e..2711259 100644 --- a/src/http/tpl.go +++ b/src/http/tpl.go @@ -12,7 +12,6 @@ import ( "net/url" "path/filepath" "strings" - "time" "dev.mediocregopher.com/mediocre-blog.git/src/http/apiutil" "dev.mediocregopher.com/mediocre-blog.git/src/post" @@ -93,27 +92,14 @@ func (a *api) draftsURL(abs bool) string { func (a *api) tplFuncs() template.FuncMap { return template.FuncMap{ - "StaticInlineCSS": func(path string) (template.CSS, error) { - path = filepath.Join("static", path) - b, err := staticFS.ReadFile(path) - return template.CSS(b), err - }, - "DraftURL": func(id string) string { - return a.draftPostURL(id, false) - }, - "DateTimeFormat": func(t time.Time) string { - return t.Format("2006-01-02") - }, - "SafeURL": func(u string) template.URL { - return template.URL(u) - }, + "DraftURL": func(id string) string { return a.draftPostURL(id, false) }, } } func (a *api) emptyTpl() *template.Template { tpl := template.New("") tpl = tpl.Funcs(a.tplFuncs()) - tpl = tpl.Funcs(template.FuncMap(a.postPreprocessFuncs().ToFuncMap())) + tpl = tpl.Funcs(a.postPreprocessFuncs().ToFuncMap()) return tpl } -- cgit v1.2.3