From d1ab0d1aae107e0a56aa4fe4eeb7a0f3d741711e Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Mon, 10 May 2021 11:30:28 -0400 Subject: [PATCH] Fix path functions --- config.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config.go b/config.go index b9b9d9d..518d990 100644 --- a/config.go +++ b/config.go @@ -94,14 +94,14 @@ var funcs = map[string]interface{}{ "safeCSS": func(s string) htemplate.CSS { return htemplate.CSS(s) }, "safeJS": func(s string) htemplate.JS { return htemplate.JS(s) }, "safeURL": func(s string) htemplate.URL { return htemplate.URL(s) }, - "path": func() map[string]interface{} { return pathFuncs }, + "path": func() pathFuncs { return pathFuncs{} }, } -var pathFuncs = map[string]interface{}{ - "Base": path.Base, - "Clean": path.Clean, - "Dir": path.Dir, - "Ext": path.Ext, - "Join": path.Join, - "Split": path.Split, -} +type pathFuncs struct{} + +func (pathFuncs) Base(s string) string { return path.Base(s) } +func (pathFuncs) Clean(s string) string { return path.Clean(s) } +func (pathFuncs) Dir(s string) string { return path.Dir(s) } +func (pathFuncs) Ext(s string) string { return path.Ext(s) } +func (pathFuncs) Join(elem ...string) string { return path.Join(elem...) } +func (pathFuncs) Split(s string) (string, string) { return path.Split(s) }