-
Notifications
You must be signed in to change notification settings - Fork 2
/
jinjava.jsonc
1739 lines (1569 loc) · 49.7 KB
/
jinjava.jsonc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
// Place your wrksp workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [a
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Set Variable": {
"prefix": ["set variable", "set value"],
"body": [
"{% set ${1:variable} = ${2:value} %}",
"{{ ${1:variable} }}"
],
"description": "Set Variable"
},
"Set Array": {
"prefix": "array",
"body": [
"{% set $1 = [$2] %}"
],
"description": "Set Array"
},
"Set Object": {
"prefix": "object",
"body": [
"{% set $1 = {'$2':'$3'} %}"
],
"description": "Set Object"
},
"Set Array With Object": {
"prefix": "array with object",
"body": [
"{% set $1 = [{'$2':'$3'}] %}"
],
"description": "Set array with object"
},
"Expression": {
"prefix": "expressionvar",
"body": [
"{% expressionvar ${1:expression-hash} %}",
"\t{{ expression_result }}",
"{% endexpressionvar %}"
],
"description": "Expression Block"
},
"Expression Var": {
"prefix": "expressionvar",
"body": [
"{% expression %} ${1:expression-hash} {% endexpression %}"
],
"description": "Expressionvar Block"
},
"Aggregate": {
"prefix": "aggregate",
"body": [
"{% aggregate ${1:aggregate-hash} %}",
"\t{{ aggregate_result[0] }}",
"{% endaggregate %}"
],
"description": "Aggregate Block"
},
"Aggregate With For": {
"prefix": "aggregate with for",
"body": [
"{% aggregate ${1:aggregate-hash} %}",
"\t{%- for ${2:item} in aggregate_result -%}",
"\t\t{{ ${2:item} }}",
"\t{%- endfor -%}",
"{% endaggregate %}"
],
"description": "Aggregate Block with for"
},
"Recommendations Block": {
"prefix": "recommendations3",
"body": [
"{% recommendations3 campaignId=${1:recommendation-id} %}",
"\t{%- for ${2:item} in recommended_products3 -%}",
"\t\t{{ ${2:item }}}",
"\t\t{{ ${2:item}.itemId }}",
"\t{%- endfor -%}",
"{% endrecommendations3 %}"
],
"description": "Recommendations Block"
},
"Recommendations as JSON": {
"prefix": "recommendations3 as JSON",
"body": [
"{% recommendations_json3 campaignId=${1:recommendation-id} %}",
"{% endrecommendations_json3 %}"
],
"description": "Recommendations as JSON"
},
"Recommendations with item context": {
"prefix": "recommendations3 with item context",
"body": [
"{% set itemContext = [] %}",
"{% aggregate ${1:aggregate-hash} %}",
"\t{%- for r in aggregate_result|reverse -%}",
"\t\t{% set _noop = itemContext.append(r.sku) %}",
"\t{%- endfor -%}",
"{% endaggregate %}",
"",
"{% recommendations3 campaignId=${2:campaign-hash} itemsIds=itemContext %}",
"\t{%- for ${3:item} in recommended_products3 -%}",
"\t\t{{ ${3:item }}}",
"\t{%- endfor -%}",
"{% endrecommendations3 %}"
],
"description": "Recommendations with an item context"
},
"Recommendations with specific item context": {
"prefix": "recommendations3 with specific item context",
"body": [
"{% set itemContext = [] %}",
"{% set _noop = itemContext.append(${1:item-id})) %} // replace item-id with the value you need",
"{% recommendations3 campaignId=${2:campaign-hash} itemsIds=itemContext %}",
"\t{%- for ${3:item} in recommended_products3 -%}",
"\t\t{{ ${3:item }}}",
"\t{%- endfor -%}",
"{% endrecommendations3 %}"
],
"description": "Recommendations with an specific item context"
},
"Recommendations with filters": {
"prefix": "recommendations3 with filters",
"body": [
"{% set filters = \"param1=='value'ANDparam2!='value2'\" %}",
"{% set additionalParam = metric_additional_params['property_name'] %} // stores value of OG tag",
"{% set filters = \"param==\"' + additionalParam +'\" %} // adds value of OG tag to your filter",
"",
"{% recommendations3 campaignId=${1:campaign-hash} additionalFilters=filters filtersJoiner=AND %}",
"\t{%- for ${3:item} in recommended_products3 -%}",
"\t\t{{ ${3:item }}}",
"\t{%- endfor -%}",
"{% endrecommendations3 %}",
"",
"{% recommendations3 campaignId=${1:campaign-hash} additionalElasticFilters=filters elasticFiltersJoiner=AND %}",
"\t{%- for ${3:item} in recommended_products3 -%}",
"\t\t{{ ${3:item }}}",
"\t{%- endfor -%}",
"{% endrecommendations3 %}",
"",
"{% recommendations3 campaignId=${1:campaign-hash} additionalFilters=filters filtersJoiner=REPLACE %}",
"\t{%- for ${3:item} in recommended_products3 -%}",
"\t\t{{ ${3:item }}}",
"\t{%- endfor -%}",
"{% endrecommendations3 %}"
],
"description": "Recommendations with filters"
},
"Recommendations with slots": {
"prefix": "recommendations3 with slots",
"body": [
"{% recommendations3 campaignId=${1:insert_recommendation_ID} %}",
"\t{% for slot_products in slots_products3 %}",
"\t\t{{ slot_products.name }}",
"\t\t{% for item in slot_products.items %}",
"\t\t\t{{ item.itemId }}",
"\t\t{% endfor %}",
"\t\t{% for row in slot_products.rows %}",
"\t\t\t{{ row.attributeValue }}",
"\t\t\t{{ row.items }}",
"\t\t{% endfor %}",
"\t{% endfor %}",
"{% endrecommendations3 %}"
],
"description": "Recommendations with slots"
},
"Dynamic content metric additional params": {
"prefix": "dynamic metric additional params",
"body": [
"{{ metric_additional_params[\"product:PARAM_NAME\"] }}"
],
"description": "To access the value of a product: meta tag's content attribute when creating dynamic content, use the following syntax"
},
"Dynamic content social proof": {
"prefix": "dynamic social proof",
"body": [
"{% socialproof %} ${1:metric-hash} {% endsocialproof %}"
],
"description": "Social proof tag"
},
"Email open in the browser": {
"prefix": "email open in the browser",
"body": [
"<a href=\"{{ synerise-open-in-browser }}\">Click to open the message in a browser</a>"
],
"description": "Generate a URL that opens the message in a browser."
},
"Email resign link": {
"prefix": "email resign link",
"body": [
"<a href=\"{{ synerise-resign-link }}\">Unsubscribe</a>"
],
"description": "Generate a URL that revokes the customer’s email communication agreement."
},
"Email preparelink": {
"prefix": "email preparelink",
"body": [
"{% set link = \"https://hub.synerise.com/\" %}",
"<a href=\"{% preparelink %}{{link}}{% endpreparelink %}\">Link text</a>"
],
"description": "If the email communication includes links, you can track their additional parameters (such as UTM) and click events."
},
"Webpush inserts": {
"prefix": "webpush insert",
"body": [
"{%- if false -%} withoutRedirect=1 {%- endif -%}"
],
"description": "Inserts can be used in all fields of the webpush definition. In the URL, Icon, and Image fields, if any jinjava is used, the following tag must be added at the end of the code of the field."
},
"Automation event parametrs": {
"prefix": "automation event parametrs",
"body": [
"{{ event.action }}",
"{{ event.params.sku }}"
],
"description": "Event parameters store additional information, such as og:tags. Some of them are required, but you can also create custom parameters. When you use the syntax below, the parameters are retrieved from the event that is the current context."
},
"Automation event context": {
"prefix": "automation event context",
"body": [
"{{ automationPathSteps['nodeName'].event.params.paramName }}",
"{{ automationPathSteps['nodeName'].event.params['paramName'] }}"
],
"description": "You can ignore the default context and refer to parameters of a specific Trigger or Event Filter node."
},
"Automation managing parameters with schemas": {
"prefix": "automation managing parameters with schemas",
"body": [
"{% context fieldId %}"
],
"description": "fieldId is the unique ID of the field, not the label used as the name of the column on the UI."
},
"Automation workflow metadata": {
"prefix": "automation workflow metadata",
"body": [
"{{currentStep.PROPERTYNAME}}"
],
"description": "You can insert properties of workflow and the current step (a step is the occurrence of a profile entering a node in the progress of a workflow)."
},
"Automation audience node syntax limitations": {
"prefix": "automation audience node syntax limitations",
"body": [
"{% set arr = [] %}{% do arr.append('6678347477') %}{% do arr.append('4551874894')%}{{ arr | join('","') }}"
],
"description": "\"is forbidden as it will be misinterpreted by Jinja, use ' instead If you want to use the IN operator in the conditions to check if a string occurs in an array, you must join the array by using join('\",\"')"
},
"Automation params": {
"prefix": "automation params from event",
"body": [
"{% set event = {params: {alertSku: 'wartosc' }}%}",
"{% set from_event = event.params.alertSku %}"
],
"description": "You can refer to event params in emails"
},
"Data transformation changing values": {
"prefix": "data transformation changing values",
"body": [
"root['columnName']"
],
"description": "You can replace the value in a column with another value."
},
"Data transformation change current value": {
"prefix": "data transformation change current value ",
"body": [
"{%- if root['paymentInfo'] == 'cash' -%}POS{%- else -%}WEB_DESKTOP{%- endif -%}"
],
"description": "The following snippet replaces the value of paymentInfo"
},
"Data transformation conditionally keep current value": {
"prefix": "data transformation conditionally keep current value ",
"body": [
"{%- if root['paymentInfo'] == 'cash' -%}{{root['paymentInfo']}}{%- else -%}WEB_DESKTOP{%- endif -%}"
],
"description": "The following snippet keeps cash as the value of paymentInfo, but replaces any other value with WEB_DESKTOP"
},
"Data transformation combine conditions": {
"prefix": "data transformation combine conditions ",
"body": [
"{%- if root['paymentInfo'] == 'cash' -%}POS{%- elif root['paymentInfo'] == 'online' -%}WEB_DESKTOP{%- else -%}UNKNOWN{%- endif -%}"
],
"description": "The following snippet replaces the value of paymentInfo: cash is replaced with POS;online is replaced with WEB_DESKTOP;any other value is replaced with UNKNOWN"
},
"Data transformation replace string": {
"prefix": "data transformation replace string ",
"body": [
"{{ root[\"g:sale_price\"]|replace(\" USD\", \"\") }}"
],
"description": "The following snippet takes the value of g:sale_price and replaces USD with an empty string, for example 256 USD becomes 256."
},
"Data transformation fill in empty values": {
"prefix": "data transformation fill in empty values ",
"body": [
"{%- if not root['paymentInfo'] -%}foo{%- else -%}{{root['paymentInfo']}}{%- endif -%}"
],
"description": "If a cell has no value (is empty), you can insert a value. The following snippet replaces a missing value of paymentInfo with foo"
},
"Data transformation event salt": {
"prefix": "data transformation event salt ",
"body": [
"{{root.orderId}}{{root.eventTimestamp}}"
],
"description": "Select two or more parameters whose combination is unique. For example, you can use orderID and eventTimestamp. Even if one of them repeats for some reason, the chances of both being identical between two events are practically zero. Add an eventSalt column. In the eventSalt column, add the following insert (example according to step 1)"
},
"Data transformation calculate revenue": {
"prefix": "data transformation calculate revenue ",
"body": [
"{% set line_sums = [0] %}",
"{%- for prod in root.products -%}",
"\t{%- if line_sums.append(prod[\"productQuantity\"]|int*prod[\"finalUnitPriceAmount\"]|replace(\",\", \".\")|float) -%}",
"\t{%- endif -%}",
"{%- endfor -%}",
"{{ line_sums|sum }}"
],
"description": "The following code uses the values from the productQuantityProduct and finalUnitPriceAmount to calculate the total value of an order. The actual code must not include any line breaks, the example uses them for better readability."
},
"Catalog": {
"prefix": "catalog",
"body": [
"{% catalog.${1:catalogName}(${2:itemKey}).${3:columnName} %}"
],
"description": "Catalog Block"
},
"Catalogvar": {
"prefix": "catalogvar",
"body": [
"{% catalogvar.${1:catalogName}(${2:itemKey}).${3:columnName} %}",
"\t{{ catalog_result }}",
"{% endcatalogvar %}"
],
"description": "Catalogvar Block"
},
"Catalogitemv2": {
"prefix": "catalogitemv2",
"body": [
"{% set key = '${1:itemKey}' %}",
"{% catalogitemv2.catalogName(key) allowEmpty=${2:True/False} %}",
"\t{% set object = catalog_result %}",
"\t{{ object.get('${3:objectColumn}').${4:propertyName} }}",
"\t{{ object.get('${5:stringColumn}') }}",
"{% endcatalogitemv2 %}"
],
"description": "Catalogvar Block"
},
"Metrics": {
"prefix": "metrics",
"body": [
"{% metrics %} ${1:metrics-hash} {% endmetrics %}"
],
"description": "Metrics Block"
},
"Metricsvar": {
"prefix": "metricsvar",
"body": [
"{% metricsvar metric_id:${1:metrics-hash} %}",
"\t{{ metric_result }}",
"{% endmetricsvar %}"
],
"description": "Metrics Block"
},
"Attribute": {
"prefix": "customer attribute",
"body": [
"{% customer ${1:attr-name} %}",
"{% customer.${1:attr-name} %}",
"{% customer['${1:attr-name}'] %}"
],
"description": "Customer attribute"
},
"Attribute With Condition": {
"prefix": "customer attribute with condition",
"body": [
"{%- if customer.get('${1:attr-name}') -%}",
"\t{{ customer.${1:attr-name} }}",
"{%- else -%}",
"\t${2:value}",
"{%- endif -%}"
],
"description": "Customer Attribute with Condition"
},
"Voucher": {
"prefix": "voucher",
"body": [
"{% voucher %} ${1:pool-id} {% endvoucher %}"
],
"description": "Voucher Block"
},
"Voucher With Assign": {
"prefix": "voucher with assign",
"body": [
"{% voucher assign=false%} ${1:pool-id} {% endvoucher %}"
],
"description": "Voucher Block with Assign"
},
"VoucherVar": {
"prefix": "vouchervar",
"body": [
"{% vouchervar id=${1:pool-id} %}",
"\t{{ voucher_result }}",
"{% endvouchervar %}"
],
"description": "Vouchervar Block"
},
"BarcodesAsImg": {
"prefix": "barcodes as image",
"body": [
"{% vouchervar id=${1:pool-id} %}",
"\t{% barcode code= {{voucher_result}}, gray=true, type=EAN_13, hrp=BOTTOM %}",
"{% endvouchervar %}"
],
"description": "Bardcode Block as Image"
},
"BarcodesAsUrl": {
"prefix": "barcodes as url",
"body": [
"{% vouchervar id=${1:pool-id} %}",
"\t{% barcodeurl code= {{voucher_result}}, gray=true, type=EAN_13, hrp=BOTTOM %}",
"{% endvouchervar %}"
],
"description": "Bardcode Block as Url"
},
"StopCommunicationFromRendering": {
"prefix": "stop",
"body": [
"{% kill %}"
],
"description": "Stop communication from rendering"
},
"If Statement Tag": {
"prefix": "if statement",
"body": [
"{% set ${1:attr} = '${2:value}' %}",
"{%- if ${1:attr} -%}",
"\t{{ ${1:attr} }}",
"{%- endif -%}"
],
"description": "If Statement"
},
"If Statement Tag Simple": {
"prefix": "if statement simple",
"body": [
"{%- if ${1:value} -%}",
"\t",
"{%- endif -%}"
],
"description": "If Statement simple"
},
"If Else Statement Tag": {
"prefix": "if else statement",
"body": [
"{% set ${1:attr} = '${2:value}' %}",
"{%- if ${1:attr} -%}",
"\t{{ ${1:attr} }}",
"{%- else -%}",
"\t${2:value}",
"{%- endif -%}"
],
"description": "If Else Statement"
},
"If ElIf Statement Tag": {
"prefix": "if elif statement",
"body": [
"{% set number = ${1:value} %}",
"{%- if number <= ${2:value} -%}",
"\t{{ number }}",
"{%- elif number <= ${3:value} -%}",
"\t{{ number }}",
"{%- else -%}",
"\t{{ number }}",
"{%- endif -%}"
],
"description": "If with Elif Statement"
},
"If Else Statement ? Tag": {
"prefix": "if elif statement",
"body": [
"{% set temp = true %}",
"{% set temp2 = false %}",
"{{ 'Update' if temp else 'Continue' }}<br>"
],
"description": "If else Tag"
},
"Append Tag": {
"prefix": "append tag",
"body": [
"{% do ${1:listname}.append('${2:string}')}"
],
"description": "You can use do append to add an item to a list."
},
"AutoEscape Tag": {
"prefix": "autoEscape tag",
"body": [
"{%- autoescape -%}",
"\t<!--Code to escape-->",
"{%- endautoescape -%}"
],
"description": "Autoescape the tag’s contents."
},
"Call Tag": {
"prefix": "call tag",
"body": [
"{%- macro render_dialog(title, class=\"dialog\") -%}",
"\t<div class=\"{{ class }}\">",
"\t\t<h2>{{ title }}</h2>",
"\t\t<div class=\"contents\">",
"\t\t\t{{ caller() }}",
"\t\t</div>",
"\t</div>",
"{%- endmacro -%}",
"",
"{%- call render_dialog('Hello World') -%}",
"\tThis is a simple dialog rendered by using a macro and a call block.",
"{%- endcall -%}"
],
"description": "In some cases, it can be useful to pass a macro to another macro."
},
"Cycle Tag": {
"prefix": "cycle tag",
"body": [
"{% set contents = [] %}",
"{%- for content in contents -%}",
"\t<div class=\"post-item {% cycle 'odd','even' %}\">",
"\t\tBlog post content",
"\t</div>",
"{- endfor -}"
],
"description": "The cycle tag can be used within a for loop to cycle through a series of string values and print them with each iteration."
},
"For Tag": {
"prefix": "for tag",
"body": [
"{% set names = ['John', 'Kate', 'Bob'] %}",
"{%- for item in names -%}",
"\tHello, {{ item }}!",
"{%- endfor -%}"
],
"description": "Outputs the inner content for each item in the given iterable."
},
"For Loop variables Tag": {
"prefix": "for variables tag",
"body": [
"{% set array = ['q','w','e','r','t'] %}",
"{%- for item in array -%}",
"\tItem: {{ item }}",
"\tIndex: {{ loop.index }}",
"\tRevindex: {{ loop.revindex }}",
"\tCycle: {{ loop.cycle('foo','bar','baz') }}",
"{%- endfor -%}"
],
"description": "Inside the for loop, you can access special variables."
},
"Ifchanged Tag": {
"prefix": "ifchanged tag",
"body": [
"{%- ifchanged variable -%}",
"\t<!-- Code to execute if the variable has changed -->",
"{%- endifchanged -%}"
],
"description": "Outputs the tag contents if the given variable has changed since a prior invocation of this tag."
},
"Macro Tag": {
"prefix": "macro tag",
"body": [
"<!-- Defining the macro -->",
"{%- macro name_of_macro(argument_name, argument_name2) -%}",
"\t{{ argument_name }}",
"\t{{ argument_name2 }}",
"{%- endmacro -%}",
"",
"<!-- Calling the macro -->",
"{{ name_of_macro('value to pass to argument 1', 'value to pass to argument 2') }}",
"",
"<!-- The macro can then be called like a function. -->",
"a { {{ name_of_macro('all', '2s ease-in-out') }} }"
],
"description": "Macros allow you to print multiple statements with a dynamic value or values."
},
"Print Tag": {
"prefix": "print tag",
"body": [
"{% set string_to_echo = 'Print me' %}",
"",
"{% print string_to_echo %}",
"{% print -65|abs %}"
],
"description": "Echoes the result of the expression."
},
"Range Tag": {
"prefix": "range tag",
"body": [
"range(start,stop,step)",
"",
"{% set foo=range(10,2,-2) %}",
"{{foo}}",
"",
"<!-- OUTPUT: -->",
"<!--[10, 8, 6, 4]-->"
],
"description": "Generates an array of integers. The array can’t be longer than 1000 items."
},
"Raw Tag": {
"prefix": "raw tag",
"body": [
"{% raw %}",
"\tThe personalization token for a contact's first name is {{ customer.firstname }}",
"{% endraw %}"
],
"description": "Processes all inner expressions as plain text."
},
"Unless Tag": {
"prefix": "unless tag",
"body": [
"{%- unless x < 0 -%}",
"\tx is greater than zero",
"{%- endunless -%}"
],
"description": "Unless is a conditional just like ‘if’, but works on an inverse logic."
},
"Update Tag": {
"prefix": "update tag",
"body": [
"{% set product = {'category':'sneakers'} %}",
"{% set colorData = {'color':'red','size': 8} %}",
"{% do product.update(colorData) %}"
],
"description": "Creates or updates the properties of an object."
},
"Test IsContainingAll": {
"prefix": "test IsContainingAll",
"body": [
"{{ [${1:values}] is containingall [${2:values}] }}"
],
"description": "IsContainingAll Test - Returns true if a list contains all the values from another list."
},
"Test IsContaining": {
"prefix": "test IsContaining ",
"body": [
"{{ [${1:values}] is containing ${2:value} }}"
],
"description": "IsContaining Test - Returns true if a list contains the provided value."
},
"Test IsDefined": {
"prefix": "test IsDefined ",
"body": [
"{%- if ${1:value} is defined -%}",
"\t",
"{%- endif -%}"
],
"description": "IsDefined Test - Returns true if the variable is defined."
},
"Test IsDivisibleBy": {
"prefix": "test IsDivisibleBy ",
"body": [
"{%- if ${1:value} is divisbleby 5 -%}",
"\t",
"{%- endif -%}"
],
"description": "IsDivisibleBy Test - Returns true if a variable is divisible by a number."
},
"Test IsEqualTo": {
"prefix": "test IsEqualTo ",
"body": [
"{%- if ${1:value} is equalto ${2:value} -%}",
"\t",
"{%- endif -%}"
],
"description": "IsEqualTo Test - Returns true if an object has the same value as another object."
},
"Test IsEven": {
"prefix": "test IsEven ",
"body": [
"{%- if ${1:value} is even -%}",
"\t",
"{%- endif -%}"
],
"description": "IsEven Test - Returns true if a value is an even number."
},
"Test IsIterable": {
"prefix": "test IsIterable ",
"body": [
"{%- if ${1:value} is iterable -%}",
"\t",
"{%- endif -%}"
],
"description": "IsIterable Test - Returns true if the object is iterable (for example, a sequence)."
},
"Test IsLower": {
"prefix": "test IsLower",
"body": [
"{%- if ${1:value} is lower -%}",
"\t",
"{%- endif -%}"
],
"description": "IsLower Test - Returns true if a string is all lowercase."
},
"Test IsMapping": {
"prefix": "test IsMapping",
"body": [
"{%- if ${1:value} is mapping -%}",
"\t",
"{%- endif -%}"
],
"description": "IsMapping Test - Returns true if an object is a dictionary."
},
"Test IsNumber": {
"prefix": "test IsNumber",
"body": [
"{%- if ${1:value} is number -%}",
"\t{{ ${1:value} * 1000000 }}",
"{%- endif -%}"
],
"description": "IsNumber Test - Returns true if the object is a number."
},
"Test IsOdd": {
"prefix": "test IsOdd",
"body": [
"{%- if ${1:value} is odd -%}",
"\t",
"{%- endif -%}"
],
"description": "IsOdd Test - Returns true if a number is an odd number."
},
"Test IsSameAs": {
"prefix": "test IsSameAs",
"body": [
"{%- if ${1:value} is sameas ${2:value} -%}",
"\t",
"{%- endif -%}"
],
"description": "IsSameAs Test - Returns true if a variable points at same object as another variable."
},
"Test IsSequence": {
"prefix": "test IsSequence",
"body": [
"{%- if ${1:value} is sequence -%}",
"\t",
"{%- endif -%}"
],
"description": "IsSequence Test = Returns true if the variable is a sequence. Sequences are variables that are iterable."
},
"Test IsStringContaining": {
"prefix": "test IsStringContaining",
"body": [
"{%- if ${1:value} is string_containing '${2:value}' -%}",
"\t",
"{%- endif -%}"
],
"description": "IsStringContaining Test - Returns true if an object is a string which contains a specified other string."
},
"Test IsString": {
"prefix": "test IsString",
"body": [
"{%- if ${1:value} is string' -%}",
"\t",
"{%- endif -%}"
],
"description": "IsString Test - Returns true if an object is a string."
},
"Test IsStringStartingWith": {
"prefix": "test IsStringStartingWith",
"body": [
"{%- if ${1:value} string_startingwith '${2:value}' -%}",
"\t",
"{%- endif -%}"
],
"description": "IsStringStartingWith Test - Returns true if an object is a string which starts with a specified other string."
},
"Test IsTruthy": {
"prefix": "test IsTruthy",
"body": [
"{%- if ${1:value} is truthy -%}",
"\t",
"{%- endif -%}"
],
"description": "IsTruthy Test - Returns true if a value is truthy. Truthy means not 0, false,null, or an empty string (a string that consists exclusively of whitespaces is not considered empty)."
},
"Test IsUndefined": {
"prefix": "test IsUndefined",
"body": [
"{%- if ${1:value} is undefined -%}",
"\t",
"{%- endif -%}"
],
"description": "IsUndefined Test - Returns true if an object is undefined."
},
"Test IsUpper": {
"prefix": "test IsUpper",
"body": [
"{%- if ${1:value} is upper -%}",
"\t",
"{%- endif -%}"
],
"description": "IsUpper Test - Returns true if a string is all uppercase."
},
"Test IsWithin": {
"prefix": "test IsWithin",
"body": [
"{{${1:value} is within [${2:values}] }}"
],
"description": "IsWithin Test - Returns true if a value is contained in a list."
},
"Filter Abs": {
"prefix": "filter Abs",
"body": [
"{% set my_number = ${1:number} %}",
"{{ my_number|abs }}"
],
"description": "Abs Filter - Returns the absolute value of the argument."
},
"Filter Add": {
"prefix": "filter Add",
"body": [
"{% set my_number = ${1:number} %}",
"{{ my_num|add(${2:number}) }}"
],
"description": "Add Filter - Adds a number to the existing value."
},
"Filter Attr": {
"prefix": "filter Attr",
"body": [
"{{ content|attr('${1:absolute_url}') }}"
],
"description": "Attr Filter - Renders the attribute of a dictionary."
},
"Filter Base64 encode/decode": {
"prefix": "filter Base64 encode/decode",
"body": [
"{% set foo = '${1:[email protected]}'|base64Encode %}",
"{{ foo }}",
"\t",
"{% set baz = foo|base64Decode %}",
"{{ baz }}"
],
"description": "Base64 encode/decode Filter - You can encode/decode values with base64."
},
"Filter Batch": {
"prefix": "filter Batch",
"body": [
"{% set items=[${1:1, 2, 3, 4, 5}] %}",
"<table>",
"\t{%- for row in items|batch(${2:3}, '${3:xxx}') -%}",
"\t\t<tr>",
"\t\t\t{%- for column in row -%}",
"\t\t\t\t<td>{{ column }}</td>",
"\t\t\t{%- endfor -%}",
"\t\t</tr>",
"\t{%- endfor -%}",
"</table>"
],
"description": "A filter that divides items in a list into groups."
},
"Filter Bool": {
"prefix": "filter Bool",
"body": [
"{%- if "true"|bool == true -%}",
"\thello world",
"{%- endif -%}"
],
"description": "Bool Filter - Converts a value into a boolean."
},
"Filter Capitalize": {
"prefix": "filter Capitalize",
"body": [
"{% set sentence = '${1:the first letter of a sentence should always be capitalized.}' %}",
"{{ sentence|capitalize }}"
],
"description": "Capitalize Filter - Capitalizes a value. The first character will be uppercase, all others lowercase."
},
"Filter Center": {
"prefix": "filter Center",
"body": [
"<pre>",
"\t{% set var = '${1:string to center}' %}",
"\t{{ var|center(${2:80}) }}",
"</pre>"
],
"description": "Center Filter - Uses whitespace to center the value in a field of a given width. This filter will only work in tags where whitespace is retained, such as <pre>."
},
"Filter Count": {
"prefix": "filter Count",
"body": [
"{% set services = [${1:'Web design', 'SEO', 'Inbound Marketing', 'PPC'}] %}",
"{{ services|count }}"
],
"description": "Count Filter - Returns the number of items in a sequence or mapping."
},
"Filter Cut": {
"prefix": "filter Cut",
"body": [
"{% set my_string = '${1:Hello world.}' %}",
"{{ my_string|cut('${2: world}') }}"
],