mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
tpl: Add math.Ceil, Floor, and Round to method mappings
This commit is contained in:
parent
d9697e275e
commit
8a69d23567
1 changed files with 21 additions and 0 deletions
|
@ -36,6 +36,13 @@ func init() {
|
|||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Ceil,
|
||||
nil,
|
||||
[][2]string{
|
||||
{"{{math.Ceil 2.1}}", "3"},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Div,
|
||||
[]string{"div"},
|
||||
[][2]string{
|
||||
|
@ -43,6 +50,13 @@ func init() {
|
|||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Floor,
|
||||
nil,
|
||||
[][2]string{
|
||||
{"{{math.Floor 1.9}}", "1"},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Log,
|
||||
nil,
|
||||
[][2]string{
|
||||
|
@ -71,6 +85,13 @@ func init() {
|
|||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Round,
|
||||
nil,
|
||||
[][2]string{
|
||||
{"{{math.Round 1.5}}", "2"},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Sub,
|
||||
[]string{"sub"},
|
||||
[][2]string{
|
||||
|
|
Loading…
Reference in a new issue