summaryrefslogtreecommitdiff
path: root/src/http/tpl.go
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2024-05-18 16:45:28 +0200
committerBrian Picciano <mediocregopher@gmail.com>2024-05-18 16:45:28 +0200
commitffa26298c95451639a6e01db6692d02d50b3d518 (patch)
tree346c5aef72e60a3c2b47e9713aea7c723c116bc1 /src/http/tpl.go
parent93a8843e2e3391459fd333aef9e5c7617608c2b3 (diff)
Remove most custom template functions from html templating
Diffstat (limited to 'src/http/tpl.go')
-rw-r--r--src/http/tpl.go18
1 files changed, 2 insertions, 16 deletions
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
}