@@ -36,6 +36,11 @@ func init() {
3636 [][2 ]string {},
3737 )
3838
39+ ns .AddMethodMapping (ctx .Append ,
40+ []string {"append" },
41+ [][2 ]string {},
42+ )
43+
3944 ns .AddMethodMapping (ctx .Apply ,
4045 []string {"apply" },
4146 [][2 ]string {},
@@ -48,11 +53,9 @@ func init() {
4853 },
4954 )
5055
51- ns .AddMethodMapping (ctx .SymDiff ,
52- []string {"symdiff" },
53- [][2 ]string {
54- {`{{ slice 1 2 3 | symdiff (slice 3 4) }}` , `[1 2 4]` },
55- },
56+ ns .AddMethodMapping (ctx .D ,
57+ nil ,
58+ [][2 ]string {},
5659 )
5760
5861 ns .AddMethodMapping (ctx .Delimit ,
@@ -72,11 +75,9 @@ func init() {
7275 [][2 ]string {},
7376 )
7477
75- ns .AddMethodMapping (ctx .KeyVals ,
76- []string {"keyVals" },
77- [][2 ]string {
78- {`{{ keyVals "key" "a" "b" }}` , `key: [a b]` },
79- },
78+ ns .AddMethodMapping (ctx .Group ,
79+ []string {"group" },
80+ [][2 ]string {},
8081 )
8182
8283 ns .AddMethodMapping (ctx .In ,
@@ -101,11 +102,43 @@ func init() {
101102 [][2 ]string {},
102103 )
103104
105+ ns .AddMethodMapping (ctx .KeyVals ,
106+ []string {"keyVals" },
107+ [][2 ]string {
108+ {`{{ keyVals "key" "a" "b" }}` , `key: [a b]` },
109+ },
110+ )
111+
104112 ns .AddMethodMapping (ctx .Last ,
105113 []string {"last" },
106114 [][2 ]string {},
107115 )
108116
117+ ns .AddMethodMapping (ctx .Merge ,
118+ []string {"merge" },
119+ [][2 ]string {
120+ {
121+ `{{ dict "title" "Hugo Rocks!" | collections.Merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") | sort }}` ,
122+ `[Yes, Hugo Rocks! Hugo Rocks!]` ,
123+ },
124+ {
125+ `{{ merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") (dict "title" "Hugo Rocks!") | sort }}` ,
126+ `[Yes, Hugo Rocks! Hugo Rocks!]` ,
127+ },
128+ {
129+ `{{ merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") (dict "title" "Hugo Rocks!") (dict "extra" "For reals!") | sort }}` ,
130+ `[Yes, Hugo Rocks! For reals! Hugo Rocks!]` ,
131+ },
132+ },
133+ )
134+
135+ ns .AddMethodMapping (ctx .NewScratch ,
136+ []string {"newScratch" },
137+ [][2 ]string {
138+ {`{{ $scratch := newScratch }}{{ $scratch.Add "b" 2 }}{{ $scratch.Add "b" 2 }}{{ $scratch.Get "b" }}` , `4` },
139+ },
140+ )
141+
109142 ns .AddMethodMapping (ctx .Querify ,
110143 []string {"querify" },
111144 [][2 ]string {
@@ -124,56 +157,46 @@ func init() {
124157 },
125158 )
126159
127- ns .AddMethodMapping (ctx .Shuffle ,
128- [] string { "shuffle" } ,
160+ ns .AddMethodMapping (ctx .Reverse ,
161+ nil ,
129162 [][2 ]string {},
130163 )
131164
132- ns .AddMethodMapping (ctx .Slice ,
133- []string {"slice " },
165+ ns .AddMethodMapping (ctx .Seq ,
166+ []string {"seq " },
134167 [][2 ]string {
135- {`{{ slice "B" "C" "A" | sort }}` , `[A B C ]` },
168+ {`{{ seq 3 }}` , `[1 2 3 ]` },
136169 },
137170 )
138171
139- ns .AddMethodMapping (ctx .Sort ,
140- []string {"sort " },
172+ ns .AddMethodMapping (ctx .Shuffle ,
173+ []string {"shuffle " },
141174 [][2 ]string {},
142175 )
143176
144- ns .AddMethodMapping (ctx .Union ,
145- []string {"union " },
177+ ns .AddMethodMapping (ctx .Slice ,
178+ []string {"slice " },
146179 [][2 ]string {
147- {`{{ union ( slice 1 2 3) (slice 3 4 5) }}` , `[1 2 3 4 5 ]` },
180+ {`{{ slice "B" "C" "A" | sort }}` , `[A B C ]` },
148181 },
149182 )
150183
151- ns .AddMethodMapping (ctx .Where ,
152- []string {"where" },
153- [][2 ]string {},
154- )
155-
156- ns .AddMethodMapping (ctx .Append ,
157- []string {"append" },
158- [][2 ]string {},
159- )
160-
161- ns .AddMethodMapping (ctx .Group ,
162- []string {"group" },
184+ ns .AddMethodMapping (ctx .Sort ,
185+ []string {"sort" },
163186 [][2 ]string {},
164187 )
165188
166- ns .AddMethodMapping (ctx .Seq ,
167- []string {"seq " },
189+ ns .AddMethodMapping (ctx .SymDiff ,
190+ []string {"symdiff " },
168191 [][2 ]string {
169- {`{{ seq 3 }}` , `[1 2 3 ]` },
192+ {`{{ slice 1 2 3 | symdiff (slice 3 4) }}` , `[1 2 4 ]` },
170193 },
171194 )
172195
173- ns .AddMethodMapping (ctx .NewScratch ,
174- []string {"newScratch " },
196+ ns .AddMethodMapping (ctx .Union ,
197+ []string {"union " },
175198 [][2 ]string {
176- {`{{ $scratch := newScratch }}{{ $scratch.Add "b" 2 }}{{ $scratch.Add "b" 2 }}{{ $scratch.Get "b" }}` , `4 ` },
199+ {`{{ union (slice 1 2 3) (slice 3 4 5) }}` , `[1 2 3 4 5] ` },
177200 },
178201 )
179202
@@ -184,22 +207,9 @@ func init() {
184207 },
185208 )
186209
187- ns .AddMethodMapping (ctx .Merge ,
188- []string {"merge" },
189- [][2 ]string {
190- {
191- `{{ dict "title" "Hugo Rocks!" | collections.Merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") | sort }}` ,
192- `[Yes, Hugo Rocks! Hugo Rocks!]` ,
193- },
194- {
195- `{{ merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") (dict "title" "Hugo Rocks!") | sort }}` ,
196- `[Yes, Hugo Rocks! Hugo Rocks!]` ,
197- },
198- {
199- `{{ merge (dict "title" "Default Title" "description" "Yes, Hugo Rocks!") (dict "title" "Hugo Rocks!") (dict "extra" "For reals!") | sort }}` ,
200- `[Yes, Hugo Rocks! For reals! Hugo Rocks!]` ,
201- },
202- },
210+ ns .AddMethodMapping (ctx .Where ,
211+ []string {"where" },
212+ [][2 ]string {},
203213 )
204214
205215 return ns
0 commit comments