Skip to content

Commit

Permalink
Adding support for some primitive template math functions
Browse files Browse the repository at this point in the history
  • Loading branch information
spf13 committed Jan 22, 2014
1 parent 0e013b5 commit 9564e6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions template/bundle/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9564e6e

Please sign in to comment.