hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 9564e6e9d8b889ddf29a777af12492a5d2560501
parent 0e013b529141f228f07bb1de0093644a04146dde
Author: spf13 <steve.francia@gmail.com>
Date:   Wed, 22 Jan 2014 17:06:23 -0500

Adding support for some primitive template math functions

Diffstat:
Mtemplate/bundle/template.go | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/template/bundle/template.go b/template/bundle/template.go
@@ -164,6 +164,12 @@ func NewTemplate() Template {
         "safeHtml":  SafeHtml,
         "first":     First,
         "highlight": Highlight,
+        "add":       func(a, b int) int { return a + b },
+        "sub":       func(a, b int) int { return a - b },
+        "div":       func(a, b int) int { return a / b },
+        "mod":       func(a, b int) int { return a % b },
+        "mul":       func(a, b int) int { return a * b },
+        "modBool":   func(a, b int) bool { return a%b == 0 },
     }
 
     templates.Funcs(funcMap)