From: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Fri, 15 Jan 2016 22:56:45 +0000 (+0100)
Subject: Add int and string cast template funcs
X-Git-Tag: v0.16~425
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=75ba84ac;p=brevno-suite%2Fhugo

Add int and string cast template funcs
---

diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go
index 3ef36d69..498a38c5 100644
--- 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,