From: Cameron Moore Date: Tue, 26 Sep 2017 02:01:59 +0000 (-0500) Subject: tpl: Add math.Ceil, Floor, and Round to method mappings X-Git-Tag: v0.29~9 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8a69d2356703d9f2fcb75bce0ae514e70ebd8e01;p=brevno-suite%2Fhugo tpl: Add math.Ceil, Floor, and Round to method mappings --- diff --git a/tpl/math/init.go b/tpl/math/init.go index 4d740c53..bbffb23a 100644 --- a/tpl/math/init.go +++ b/tpl/math/init.go @@ -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{