mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-30 01:31:06 -05:00
tplimpl: Add built-in print funcs to FuncMap
Add print, printf, and println to the Hugo FuncMap so that they are accessible to the apply template func. Updates #3139
This commit is contained in:
parent
a2a8a651f7
commit
45b9d7223a
2 changed files with 9 additions and 0 deletions
|
@ -2152,6 +2152,9 @@ func (t *templateFuncster) initFuncMap() {
|
||||||
"partialCached": t.partialCached,
|
"partialCached": t.partialCached,
|
||||||
"plainify": plainify,
|
"plainify": plainify,
|
||||||
"pluralize": pluralize,
|
"pluralize": pluralize,
|
||||||
|
"print": fmt.Sprint,
|
||||||
|
"printf": fmt.Sprintf,
|
||||||
|
"println": fmt.Sprintln,
|
||||||
"querify": querify,
|
"querify": querify,
|
||||||
"readDir": t.readDirFromWorkingDir,
|
"readDir": t.readDirFromWorkingDir,
|
||||||
"readFile": t.readFileFromWorkingDir,
|
"readFile": t.readFileFromWorkingDir,
|
||||||
|
|
|
@ -148,6 +148,9 @@ md5: {{ md5 "Hello world, gophers!" }}
|
||||||
mod: {{mod 15 3}}
|
mod: {{mod 15 3}}
|
||||||
modBool: {{modBool 15 3}}
|
modBool: {{modBool 15 3}}
|
||||||
mul: {{mul 2 3}}
|
mul: {{mul 2 3}}
|
||||||
|
print: {{ print "works!" }}
|
||||||
|
printf: {{ printf "%s!" "works" }}
|
||||||
|
println: {{ println "works!" -}}
|
||||||
plainify: {{ plainify "Hello <strong>world</strong>, gophers!" }}
|
plainify: {{ plainify "Hello <strong>world</strong>, gophers!" }}
|
||||||
pluralize: {{ "cat" | pluralize }}
|
pluralize: {{ "cat" | pluralize }}
|
||||||
querify 1: {{ (querify "foo" 1 "bar" 2 "baz" "with spaces" "qux" "this&that=those") | safeHTML }}
|
querify 1: {{ (querify "foo" 1 "bar" 2 "baz" "with spaces" "qux" "this&that=those") | safeHTML }}
|
||||||
|
@ -221,6 +224,9 @@ md5: b3029f756f98f79e7f1b7f1d1f0dd53b
|
||||||
mod: 0
|
mod: 0
|
||||||
modBool: true
|
modBool: true
|
||||||
mul: 6
|
mul: 6
|
||||||
|
print: works!
|
||||||
|
printf: works!
|
||||||
|
println: works!
|
||||||
plainify: Hello world, gophers!
|
plainify: Hello world, gophers!
|
||||||
pluralize: cats
|
pluralize: cats
|
||||||
querify 1: bar=2&baz=with+spaces&foo=1&qux=this%26that%3Dthose
|
querify 1: bar=2&baz=with+spaces&foo=1&qux=this%26that%3Dthose
|
||||||
|
|
Loading…
Reference in a new issue