tpl/transform: Make it a package that stands on its own

See #3042
This commit is contained in:
Bjørn Erik Pedersen
2017-04-30 23:16:54 +02:00
parent ee5aa84f2a
commit 55f90a3a0d
4 changed files with 54 additions and 19 deletions

View File

@@ -37,6 +37,7 @@ import (
_ "github.com/spf13/hugo/tpl/safe"
_ "github.com/spf13/hugo/tpl/strings"
_ "github.com/spf13/hugo/tpl/time"
_ "github.com/spf13/hugo/tpl/transform"
)
// Get retrieves partial output from the cache based upon the partial name.
@@ -91,20 +92,13 @@ func (t *templateFuncster) initFuncMap() {
funcMap := template.FuncMap{
// Namespaces
//"time": t.time.Namespace,
"transform": t.transform.Namespace,
"urls": t.urls.Namespace,
"urls": t.urls.Namespace,
"absURL": t.urls.AbsURL,
"absLangURL": t.urls.AbsLangURL,
"emojify": t.transform.Emojify,
"highlight": t.transform.Highlight,
"htmlEscape": t.transform.HTMLEscape,
"htmlUnescape": t.transform.HTMLUnescape,
"int": func(v interface{}) (int, error) { return cast.ToIntE(v) },
"markdownify": t.transform.Markdownify,
"partial": t.partial,
"partialCached": t.partialCached,
"plainify": t.transform.Plainify,
"print": fmt.Sprint,
"printf": fmt.Sprintf,
"println": fmt.Sprintln,