Add int and string cast template funcs - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 75ba84acbf8469667cb41efa89b81526a18d6a0a
DIR parent f89eb349e4d6e9044fe54492f63f73317b1d6b0c
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Fri, 15 Jan 2016 23:56:45 +0100
Add int and string cast template funcs
Diffstat:
M tpl/template_funcs.go | 2 ++
1 file changed, 2 insertions(+), 0 deletions(-)
---
DIR diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go
@@ -1507,6 +1507,8 @@ func init() {
"relref": RelRef,
"apply": Apply,
"chomp": Chomp,
+ "int": func(v interface{}) int { return cast.ToInt(v) },
+ "string": func(v interface{}) string { return cast.ToString(v) },
"replace": Replace,
"trim": Trim,
"dateFormat": DateFormat,