mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
@@ -21,7 +21,6 @@ import (
|
||||
|
||||
bp "github.com/spf13/hugo/bufferpool"
|
||||
"github.com/spf13/hugo/deps"
|
||||
"github.com/spf13/hugo/tpl/time"
|
||||
"github.com/spf13/hugo/tpl/transform"
|
||||
"github.com/spf13/hugo/tpl/urls"
|
||||
)
|
||||
@@ -32,7 +31,6 @@ type templateFuncster struct {
|
||||
cachedPartials partialCache
|
||||
|
||||
// Namespaces
|
||||
time *time.Namespace
|
||||
transform *transform.Namespace
|
||||
urls *urls.Namespace
|
||||
|
||||
@@ -45,7 +43,6 @@ func newTemplateFuncster(deps *deps.Deps) *templateFuncster {
|
||||
cachedPartials: partialCache{p: make(map[string]interface{})},
|
||||
|
||||
// Namespaces
|
||||
time: time.New(),
|
||||
transform: transform.New(deps),
|
||||
urls: urls.New(deps),
|
||||
}
|
||||
|
@@ -36,6 +36,7 @@ import (
|
||||
_ "github.com/spf13/hugo/tpl/os"
|
||||
_ "github.com/spf13/hugo/tpl/safe"
|
||||
_ "github.com/spf13/hugo/tpl/strings"
|
||||
_ "github.com/spf13/hugo/tpl/time"
|
||||
)
|
||||
|
||||
// Get retrieves partial output from the cache based upon the partial name.
|
||||
@@ -95,14 +96,12 @@ func (t *templateFuncster) initFuncMap() {
|
||||
|
||||
"absURL": t.urls.AbsURL,
|
||||
"absLangURL": t.urls.AbsLangURL,
|
||||
"dateFormat": t.time.Format,
|
||||
"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,
|
||||
"now": t.time.Now,
|
||||
"partial": t.partial,
|
||||
"partialCached": t.partialCached,
|
||||
"plainify": t.transform.Plainify,
|
||||
@@ -114,7 +113,6 @@ func (t *templateFuncster) initFuncMap() {
|
||||
"relLangURL": t.urls.RelLangURL,
|
||||
"relref": t.urls.RelRef,
|
||||
"string": func(v interface{}) (string, error) { return cast.ToStringE(v) },
|
||||
"time": t.time.AsTime,
|
||||
"urlize": t.PathSpec.URLize,
|
||||
}
|
||||
|
||||
|
@@ -146,7 +146,6 @@ relURL 1: {{ "http://gohugo.io/" | relURL }}
|
||||
relURL 2: {{ "mystyle.css" | relURL }}
|
||||
relURL 3: {{ mul 2 21 | relURL }}
|
||||
strings.TrimPrefix: {{ strings.TrimPrefix "Goodbye,, world!" "Goodbye," }}
|
||||
time: {{ (time "2015-01-21").Year }}
|
||||
urlize: {{ "Bat Man" | urlize }}
|
||||
`
|
||||
|
||||
@@ -174,7 +173,6 @@ relURL 1: http://gohugo.io/
|
||||
relURL 2: /hugo/mystyle.css
|
||||
relURL 3: /hugo/42
|
||||
strings.TrimPrefix: , world!
|
||||
time: 2015
|
||||
urlize: bat-man
|
||||
`
|
||||
|
||||
|
Reference in New Issue
Block a user