mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-23 23:41:30 +00:00
Adding support for some primitive template math functions
This commit is contained in:
parent
0e013b5291
commit
9564e6e9d8
1 changed files with 6 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue