Add a newScratch template func

Fixes #4685
This commit is contained in:
Bjørn Erik Pedersen
2018-07-06 14:12:10 +02:00
parent 43338c3a99
commit 2b8d907ab7
14 changed files with 319 additions and 231 deletions

View File

@@ -144,6 +144,14 @@ func init() {
{`{{ seq 3 }}`, `[1 2 3]`},
},
)
ns.AddMethodMapping(ctx.NewScratch,
[]string{"newScratch"},
[][2]string{
{`{{ $scratch := newScratch }}{{ $scratch.Add "b" 2 }}{{ $scratch.Add "b" 2 }}{{ $scratch.Get "b" }}`, `4`},
},
)
ns.AddMethodMapping(ctx.Uniq,
[]string{"uniq"},
[][2]string{