miki-template 1.3.3 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/.eslintrc.json +16 -0
  2. package/.github/release-notes/v1.3.1.md +55 -55
  3. package/.github/release-notes/v1.3.3.md +77 -0
  4. package/.github/workflows/ci.yml +38 -54
  5. package/.github/workflows/release.yml +106 -0
  6. package/AGENT.md +71 -71
  7. package/API_REFERENCE.md +314 -314
  8. package/CHANGELOG.md +173 -169
  9. package/CODE_OF_CONDUCT.md +14 -14
  10. package/CONTRIBUTING.md +27 -27
  11. package/README.md +342 -321
  12. package/ROADMAP.md +40 -40
  13. package/benchmarks/report.json +16 -16
  14. package/benchmarks/run.js +49 -49
  15. package/benchmarks/stress.mjs +647 -647
  16. package/benchmarks/templates/large.dtpl +7 -7
  17. package/benchmarks/templates/medium.dtpl +3 -3
  18. package/benchmarks/templates/small.dtpl +7 -7
  19. package/context/component.md +109 -109
  20. package/context/prd.md +131 -131
  21. package/context/project-structure.md +33 -33
  22. package/dir/base.html +22 -22
  23. package/dir/cmpnt.html +10 -10
  24. package/dir/footer.html +2 -2
  25. package/dir/home.html +80 -80
  26. package/dir/index.html +80 -0
  27. package/dir/navbar.html +8 -8
  28. package/docs/README.md +18 -18
  29. package/docs/advanced_usage.md +71 -71
  30. package/docs/api.md +119 -119
  31. package/docs/filters.md +708 -708
  32. package/docs/installation.md +106 -106
  33. package/docs/overview.md +79 -57
  34. package/docs/partialdef.md +70 -70
  35. package/docs/security.md +27 -27
  36. package/docs/tags.md +673 -673
  37. package/docs/usage.md +646 -646
  38. package/eslint.config.mjs +42 -42
  39. package/ex.mjs +34 -32
  40. package/live-test/package-lock.json +915 -0
  41. package/live-test/package.json +9 -0
  42. package/live-test/server.js +14 -0
  43. package/live-test/views/base.html +8 -0
  44. package/live-test/views/child.html +7 -0
  45. package/live-test/views/index.html +1 -0
  46. package/miki-template-extension/.github/workflows/ci.yml +116 -116
  47. package/miki-template-extension/.vscodeignore +7 -7
  48. package/miki-template-extension/CHANGELOG.md +99 -99
  49. package/miki-template-extension/LICENSE +21 -21
  50. package/miki-template-extension/README.md +273 -273
  51. package/miki-template-extension/extension.js +1013 -1013
  52. package/miki-template-extension/icon.svg +10 -10
  53. package/miki-template-extension/package.json +280 -280
  54. package/miki-template-extension/snippets/miki-template.json +717 -717
  55. package/miki-template-extension/syntaxes/language-configuration.json +114 -114
  56. package/miki-template-extension/syntaxes/miki-template.tmLanguage.json +355 -355
  57. package/miki-template-extension/tests/grammar-tests.json +162 -162
  58. package/miki-template-extension/tests/run-grammar-tests.js +82 -82
  59. package/package.json +40 -34
  60. package/sample-app/package-lock.json +901 -0
  61. package/sample-app/package.json +9 -0
  62. package/sample-app/server.js +14 -0
  63. package/sample-app/views/index.html +1 -0
  64. package/scripts/build-vsix.js +129 -129
  65. package/scripts/build-vsix.ps1 +15 -15
  66. package/snippets/miki-template.json +177 -177
  67. package/src/asyncRender.js +20 -20
  68. package/src/cache.js +80 -80
  69. package/src/context.js +126 -126
  70. package/src/context_processors.js +48 -48
  71. package/src/esm.mjs +89 -84
  72. package/src/filters.js +975 -975
  73. package/src/i18n.js +171 -171
  74. package/src/index.js +1112 -940
  75. package/src/lexer.js +114 -114
  76. package/src/libraries.js +371 -371
  77. package/src/parser.js +270 -270
  78. package/src/security.js +53 -53
  79. package/src/tags/control.js +719 -719
  80. package/src/tags/extra.js +154 -154
  81. package/src/tags/helpers.js +26 -26
  82. package/src/tags/i18n.js +256 -256
  83. package/src/tags/inheritance.js +335 -335
  84. package/src/tags/registry.js +18 -18
  85. package/src/tags/util.js +400 -400
  86. package/src/types.d.ts +107 -107
  87. package/syntaxes/language-configuration.json +26 -26
  88. package/syntaxes/miki-template.tmLanguage.json +146 -146
  89. package/tests/asyncRender.test.js +17 -17
  90. package/tests/base.html +6 -6
  91. package/tests/child.html +3 -3
  92. package/tests/context_processors.test.js +13 -13
  93. package/tests/esm.test.mjs +61 -61
  94. package/tests/filters.test.js +254 -254
  95. package/tests/finder-appdirs.test.js +19 -0
  96. package/tests/finder.test.js +17 -0
  97. package/tests/fixtures/views/nested/index.html +1 -0
  98. package/tests/fixtures/views/partial.html +1 -0
  99. package/tests/fixtures/views/sub/deepfile.html +1 -0
  100. package/tests/fixtures/views-appdirs/product/site/detail.html +1 -0
  101. package/tests/include_security.test.js +9 -9
  102. package/tests/integration/README.md +32 -32
  103. package/tests/integration/features.test.cjs +1681 -1681
  104. package/tests/integration/features.test.mjs +1697 -1697
  105. package/tests/integration/finder.esm.test.mjs +13 -0
  106. package/tests/integration/templates/base.miki +6 -6
  107. package/tests/integration/templates/child.miki +6 -6
  108. package/tests/integration/templates/index.html +17 -17
  109. package/tests/lexer.test.js +45 -45
  110. package/tests/parser.test.js +57 -57
  111. package/tests/partial.html +1 -1
  112. package/tests/partialdef.test.js +79 -79
  113. package/tests/production_checks.js +57 -57
  114. package/tests/security.test.js +28 -28
  115. package/tests/tags.test.js +233 -233
@@ -1,717 +1,717 @@
1
- {
2
- "meta": {
3
- "name": "miki-template",
4
- "description": "Comprehensive snippets for miki-template and Django templates"
5
- },
6
- "snippets": {
7
- "if": {
8
- "prefix": "if",
9
- "body": [
10
- "{% if ${1:condition} %}",
11
- " $2",
12
- "{% endif %}"
13
- ],
14
- "description": "If block"
15
- },
16
- "ifelif": {
17
- "prefix": "ifelif",
18
- "body": [
19
- "{% if ${1:condition} %}",
20
- " $2",
21
- "{% elif ${3:condition} %}",
22
- " $4",
23
- "{% endif %}"
24
- ],
25
- "description": "If/elif block"
26
- },
27
- "ifelse": {
28
- "prefix": "ifelse",
29
- "body": [
30
- "{% if ${1:condition} %}",
31
- " $2",
32
- "{% else %}",
33
- " $3",
34
- "{% endif %}"
35
- ],
36
- "description": "If/else block"
37
- },
38
- "ifelifelse": {
39
- "prefix": "ifelifelse",
40
- "body": [
41
- "{% if ${1:condition} %}",
42
- " $2",
43
- "{% elif ${3:condition} %}",
44
- " $4",
45
- "{% else %}",
46
- " $5",
47
- "{% endif %}"
48
- ],
49
- "description": "If/elif/else block"
50
- },
51
- "for": {
52
- "prefix": "for",
53
- "body": [
54
- "{% for ${1:item} in ${2:items} %}",
55
- " $3",
56
- "{% empty %}",
57
- " $4",
58
- "{% endfor %}"
59
- ],
60
- "description": "For loop with empty"
61
- },
62
- "for-simple": {
63
- "prefix": "for-simple",
64
- "body": [
65
- "{% for ${1:item} in ${2:items} %}",
66
- " $3",
67
- "{% endfor %}"
68
- ],
69
- "description": "Simple for loop"
70
- },
71
- "forloop-counter": {
72
- "prefix": "forloop",
73
- "body": [
74
- "{% for ${1:item} in ${2:items} %}",
75
- " {{ forloop.counter }}. ${1}",
76
- "{% endfor %}"
77
- ],
78
- "description": "For loop with forloop.counter"
79
- },
80
- "forloop-nested": {
81
- "prefix": "forloop-nested",
82
- "body": [
83
- "{% for ${1:outer} in ${2:outers %}",
84
- " {% for ${3:inner} in ${4:inners} %}",
85
- " {{ forloop.parentloop.counter }}.{{ forloop.counter }}: {{ ${3} }}",
86
- " {% endfor %}",
87
- "{% endfor %}"
88
- ],
89
- "description": "Nested for loops with parentloop"
90
- },
91
- "for-unpack": {
92
- "prefix": "for-unpack",
93
- "body": [
94
- "{% for ${1:key}, ${2:value} in ${3:dict} %}",
95
- " {{ ${1} }}: {{ ${2} }}",
96
- "{% endfor %}"
97
- ],
98
- "description": "For loop with tuple unpacking"
99
- },
100
- "with": {
101
- "prefix": "with",
102
- "body": [
103
- "{% with ${1:var} as ${2:alias} %}",
104
- " $3",
105
- "{% endwith %}"
106
- ],
107
- "description": "With block"
108
- },
109
- "with-multi": {
110
- "prefix": "with-multi",
111
- "body": [
112
- "{% with ${1:var1}=${2:value1} ${3:var2}=${4:value2} %}",
113
- " $5",
114
- "{% endwith %}"
115
- ],
116
- "description": "With multiple variables"
117
- },
118
- "cycle": {
119
- "prefix": "cycle",
120
- "body": "{% cycle '${1:odd}' '${2:even}' %}",
121
- "description": "Cycle between values"
122
- },
123
- "cycle-named": {
124
- "prefix": "cycle-named",
125
- "body": "{% cycle '${1:odd}' '${2:even}' as ${3:marker} silent %}",
126
- "description": "Named cycle with state"
127
- },
128
- "firstof": {
129
- "prefix": "firstof",
130
- "body": "{% firstof ${1:var1} ${2:var2} \"${3:fallback}\" %}",
131
- "description": "First truthy value"
132
- },
133
- "comment": {
134
- "prefix": "comment",
135
- "body": [
136
- "{% comment %}",
137
- " $1",
138
- "{% endcomment %}"
139
- ],
140
- "description": "Comment block"
141
- },
142
- "comment-inline": {
143
- "prefix": "comment-inline",
144
- "body": "{% comment %}$1{% endcomment %}",
145
- "description": "Inline comment"
146
- },
147
- "verbatim": {
148
- "prefix": "verbatim",
149
- "body": [
150
- "{% verbatim %}",
151
- " $1",
152
- "{% endverbatim %}"
153
- ],
154
- "description": "Raw content (no parsing)"
155
- },
156
- "spaceless": {
157
- "prefix": "spaceless",
158
- "body": [
159
- "{% spaceless %}",
160
- " $1",
161
- "{% endspaceless %}"
162
- ],
163
- "description": "Remove whitespace"
164
- },
165
- "autoescape": {
166
- "prefix": "autoescape",
167
- "body": [
168
- "{% autoescape ${1:on} %}",
169
- " $2",
170
- "{% endautoescape %}"
171
- ],
172
- "description": "Autoescape block"
173
- },
174
- "block": {
175
- "prefix": "block",
176
- "body": [
177
- "{% block ${1:name} %}",
178
- " $2",
179
- "{% endblock %}"
180
- ],
181
- "description": "Block definition"
182
- },
183
- "block-super": {
184
- "prefix": "block-super",
185
- "body": [
186
- "{% block ${1:name} %}",
187
- " {{ block.super }}",
188
- " $2",
189
- "{% endblock %}"
190
- ],
191
- "description": "Block with block.super"
192
- },
193
- "extends": {
194
- "prefix": "extends",
195
- "body": "{% extends \"${1:base.html}\" %}",
196
- "description": "Extend parent template"
197
- },
198
- "include": {
199
- "prefix": "include",
200
- "body": "{% include \"${1:template.html}\" %}",
201
- "description": "Include template"
202
- },
203
- "include-with": {
204
- "prefix": "include-with",
205
- "body": "{% include \"${1:template.html}\" with ${2:var}=${3:value} %}",
206
- "description": "Include with context"
207
- },
208
- "include-only": {
209
- "prefix": "include-only",
210
- "body": "{% include \"${1:template.html}\" only %}",
211
- "description": "Include without context"
212
- },
213
- "partialdef": {
214
- "prefix": "partialdef",
215
- "body": [
216
- "{% partialdef ${1:name} %}",
217
- " $2",
218
- "{% endpartialdef %}"
219
- ],
220
- "description": "Define partial template"
221
- },
222
- "partialdef-inline": {
223
- "prefix": "partialdef-inline",
224
- "body": [
225
- "{% partialdef ${1:name} inline %}",
226
- " $2",
227
- "{% endpartialdef %}"
228
- ],
229
- "description": "Define inline partial"
230
- },
231
- "partialdef-lazy": {
232
- "prefix": "partialdef-lazy",
233
- "body": [
234
- "{% partialdef ${1:name} lazy %}",
235
- " $2",
236
- "{% endpartialdef %}"
237
- ],
238
- "description": "Define lazy partial"
239
- },
240
- "partial": {
241
- "prefix": "partial",
242
- "body": "{% partial ${1:name} %}",
243
- "description": "Render partial"
244
- },
245
- "partial-with": {
246
- "prefix": "partial-with",
247
- "body": "{% partial ${1:name} with ${2:var}=${3:value} %}",
248
- "description": "Render partial with context"
249
- },
250
- "load": {
251
- "prefix": "load",
252
- "body": "{% load ${1:i18n} %}",
253
- "description": "Load tag library"
254
- },
255
- "trans": {
256
- "prefix": "trans",
257
- "body": "{% trans \"${1:Hello, World!}\" %}",
258
- "description": "Translate string"
259
- },
260
- "trans-var": {
261
- "prefix": "trans-var",
262
- "body": "{% trans \"${1:Hello, %s!}\" ${2:var} %}",
263
- "description": "Translate with variable"
264
- },
265
- "blocktrans": {
266
- "prefix": "blocktrans",
267
- "body": [
268
- "{% blocktrans with ${1:name}=${2:value} %}",
269
- " $3",
270
- "{% endblocktrans %}"
271
- ],
272
- "description": "Translate block"
273
- },
274
- "blocktrans-plural": {
275
- "prefix": "blocktrans-plural",
276
- "body": [
277
- "{% blocktrans with ${1:name}=${2:value} count ${3:n}=${4:items|length %}",
278
- " {{ name }} has {{ ${3} }} item.",
279
- "{% plural %}",
280
- " {{ name }} has {{ ${3} }} items.",
281
- "{% endblocktrans %}"
282
- ],
283
- "description": "Translate block with plural"
284
- },
285
- "language": {
286
- "prefix": "language",
287
- "body": [
288
- "{% language \"${1:fr}\" %}",
289
- " $2",
290
- "{% endlanguage %}"
291
- ],
292
- "description": "Switch language"
293
- },
294
- "regroup": {
295
- "prefix": "regroup",
296
- "body": [
297
- "{% regroup ${1:items} by ${2:attribute} as ${3:groups} %}",
298
- "{% for ${4:group} in ${3} %}",
299
- " <h3>{{ ${4}.grouper }}</h3>",
300
- "{% endfor %}"
301
- ],
302
- "description": "Regroup by attribute"
303
- },
304
- "cache": {
305
- "prefix": "cache",
306
- "body": [
307
- "{% cache ${1:timeout} ${2:key} %}",
308
- " $3",
309
- "{% endcache %}"
310
- ],
311
- "description": "Cache block"
312
- },
313
- "filter-block": {
314
- "prefix": "filter-block",
315
- "body": [
316
- "{% filter ${1:lower} %}",
317
- " $2",
318
- "{% endfilter %}"
319
- ],
320
- "description": "Filter block"
321
- },
322
- "widthratio": {
323
- "prefix": "widthratio",
324
- "body": "{% widthratio ${1:value} ${2:max} ${3:max_width} %}",
325
- "description": "Proportional width"
326
- },
327
- "csrf": {
328
- "prefix": "csrf",
329
- "body": "{% csrf_token %}",
330
- "description": "CSRF token"
331
- },
332
- "csp": {
333
- "prefix": "csp",
334
- "body": "<script {% csp_nonce_attr %}>$1</script>",
335
- "description": "CSP nonce attribute"
336
- },
337
- "static": {
338
- "prefix": "static",
339
- "body": "{% static \"${1:css/app.css}\" %}",
340
- "description": "Static file URL"
341
- },
342
- "url": {
343
- "prefix": "url",
344
- "body": "{% url \"${1:route}\" %}",
345
- "description": "URL by name"
346
- },
347
- "url-args": {
348
- "prefix": "url-args",
349
- "body": "{% url \"${1:route}\" ${2:arg1} ${3:arg2} %}",
350
- "description": "URL with positional args"
351
- },
352
- "url-kwargs": {
353
- "prefix": "url-kwargs",
354
- "body": "{% url \"${1:route}\" ${2:key}=${3:value} %}",
355
- "description": "URL with keyword args"
356
- },
357
- "debug": {
358
- "prefix": "debug",
359
- "body": "{% debug %}",
360
- "description": "Debug output"
361
- },
362
- "templatetag": {
363
- "prefix": "templatetag",
364
- "body": "{% templatetag ${1|openblock|closeblock|openvariable|closevariable|openbrace|closebrace|opencomment|closecomment} %}",
365
- "description": "Render template tag symbol"
366
- },
367
- "addtoblock": {
368
- "prefix": "addtoblock",
369
- "body": [
370
- "{% addtoblock ${1:css %}",
371
- " $2",
372
- "{% endaddtoblock %}"
373
- ],
374
- "description": "Add content to block"
375
- },
376
- "prettier-ignore": {
377
- "prefix": "prettier-ignore",
378
- "body": "{# prettier-ignore #}",
379
- "description": "Prettier ignore (single line)"
380
- },
381
- "prettier-ignore-start": {
382
- "prefix": "prettier-ignore-start",
383
- "body": [
384
- "{# prettier-ignore-start #}",
385
- "$1",
386
- "{# prettier-ignore-end #}"
387
- ],
388
- "description": "Prettier ignore region"
389
- },
390
- "filter-upper": {
391
- "prefix": "upper",
392
- "body": "{{ ${1:value}|upper }}",
393
- "description": "Convert to uppercase"
394
- },
395
- "filter-lower": {
396
- "prefix": "lower",
397
- "body": "{{ ${1:value}|lower }}",
398
- "description": "Convert to lowercase"
399
- },
400
- "filter-title": {
401
- "prefix": "title",
402
- "body": "{{ ${1:value}|title }}",
403
- "description": "Title case"
404
- },
405
- "filter-capfirst": {
406
- "prefix": "capfirst",
407
- "body": "{{ ${1:value}|capfirst }}",
408
- "description": "Capitalize first letter"
409
- },
410
- "filter-default": {
411
- "prefix": "default",
412
- "body": "{{ ${1:value}|default:\"${2:fallback}\" }}",
413
- "description": "Default value if falsy"
414
- },
415
- "filter-default-if-none": {
416
- "prefix": "default_if_none",
417
- "body": "{{ ${1:value}|default_if_none:\"${2:fallback}\" }}",
418
- "description": "Default if None/undefined"
419
- },
420
- "filter-length": {
421
- "prefix": "length",
422
- "body": "{{ ${1:value}|length }}",
423
- "description": "Length of value"
424
- },
425
- "filter-slice": {
426
- "prefix": "slice",
427
- "body": "{{ ${1:value}|slice:\"${2:0:3}\" }}",
428
- "description": "Slice array/string"
429
- },
430
- "filter-join": {
431
- "prefix": "join",
432
- "body": "{{ ${1:list}|join:\"${2:, }\" }}",
433
- "description": "Join array elements"
434
- },
435
- "filter-first": {
436
- "prefix": "first",
437
- "body": "{{ ${1:list}|first }}",
438
- "description": "First element"
439
- },
440
- "filter-last": {
441
- "prefix": "last",
442
- "body": "{{ ${1:list}|last }}",
443
- "description": "Last element"
444
- },
445
- "filter-truncatewords": {
446
- "prefix": "truncatewords",
447
- "body": "{{ ${1:text}|truncatewords:${2:10} }}",
448
- "description": "Truncate by words"
449
- },
450
- "filter-truncatechars": {
451
- "prefix": "truncatechars",
452
- "body": "{{ ${1:text}|truncatechars:${2:100} }}",
453
- "description": "Truncate by characters"
454
- },
455
- "filter-striptags": {
456
- "prefix": "striptags",
457
- "body": "{{ ${1:html}|striptags }}",
458
- "description": "Strip HTML tags"
459
- },
460
- "filter-safe": {
461
- "prefix": "safe",
462
- "body": "{{ ${1:html}|safe }}",
463
- "description": "Mark as HTML safe"
464
- },
465
- "filter-escape": {
466
- "prefix": "escape",
467
- "body": "{{ ${1:value}|escape }}",
468
- "description": "Escape HTML"
469
- },
470
- "filter-linebreaks": {
471
- "prefix": "linebreaks",
472
- "body": "{{ ${1:text}|linebreaks }}",
473
- "description": "Convert line breaks to HTML"
474
- },
475
- "filter-date": {
476
- "prefix": "date",
477
- "body": "{{ ${1:date}|date:\"${2:Y-m-d}\" }}",
478
- "description": "Format date"
479
- },
480
- "filter-time": {
481
- "prefix": "time",
482
- "body": "{{ ${1:date}|time:\"${2:H:i}\" }}",
483
- "description": "Format time"
484
- },
485
- "filter-add": {
486
- "prefix": "add",
487
- "body": "{{ ${1:value}|add:${2:1} }}",
488
- "description": "Add value"
489
- },
490
- "filter-floatformat": {
491
- "prefix": "floatformat",
492
- "body": "{{ ${1:value}|floatformat:${2:2} }}",
493
- "description": "Format decimal"
494
- },
495
- "filter-divisibleby": {
496
- "prefix": "divisibleby",
497
- "body": "{{ ${1:value}|divisibleby:${2:2} }}",
498
- "description": "Check divisibility"
499
- },
500
- "filter-mod": {
501
- "prefix": "mod",
502
- "body": "{{ ${1:value}|mod:${2:2} }}",
503
- "description": "Modulo operation"
504
- },
505
- "filter-with": {
506
- "prefix": "with-filter",
507
- "body": "{{ ${1:value}|with:${2:var}=${3:value} }}",
508
- "description": "Add context to value"
509
- },
510
- "filter-json-script": {
511
- "prefix": "json_script",
512
- "body": "{{ ${1:data}|json_script:${2:'id'} }}",
513
- "description": "JSON script tag"
514
- },
515
- "filter-urlencode": {
516
- "prefix": "urlencode",
517
- "body": "{{ ${1:value}|urlencode }}",
518
- "description": "URL encode"
519
- },
520
- "filter-yesno": {
521
- "prefix": "yesno",
522
- "body": "{{ ${1:value}|yesno:\"${2:yes,no,maybe}\" }}",
523
- "description": "Yes/No/Maybe mapping"
524
- },
525
- "filter-pluralize": {
526
- "prefix": "pluralize",
527
- "body": "{{ ${1:count}|pluralize }}",
528
- "description": "Pluralize suffix"
529
- },
530
- "filter-pluralize-custom": {
531
- "prefix": "pluralize-custom",
532
- "body": "{{ ${1:count}|pluralize:\"${2:y,ies}\" }}",
533
- "description": "Custom plural suffix"
534
- },
535
- "filter-filesizeformat": {
536
- "prefix": "filesizeformat",
537
- "body": "{{ ${1:bytes}|filesizeformat }}",
538
- "description": "Format file size"
539
- },
540
- "filter-intcomma": {
541
- "prefix": "intcomma",
542
- "body": "{{ ${1:number}|intcomma }}",
543
- "description": "Integer with commas"
544
- },
545
- "filter-timesince": {
546
- "prefix": "timesince",
547
- "body": "{{ ${1:date}|timesince }}",
548
- "description": "Time since"
549
- },
550
- "filter-timeuntil": {
551
- "prefix": "timeuntil",
552
- "body": "{{ ${1:date}|timeuntil }}",
553
- "description": "Time until"
554
- },
555
- "filter-strftime": {
556
- "prefix": "strftime",
557
- "body": "{{ ${1:date}|strftime:\"${2:PPpp}\" }}",
558
- "description": "Format with date-fns"
559
- },
560
- "filter-dictsort": {
561
- "prefix": "dictsort",
562
- "body": "{{ ${1:list}|dictsort:\"${2:key}\" }}",
563
- "description": "Sort by key"
564
- },
565
- "filter-dictsortreversed": {
566
- "prefix": "dictsortreversed",
567
- "body": "{{ ${1:list}|dictsortreversed:\"${2:key}\" }}",
568
- "description": "Sort by key (reversed)"
569
- },
570
- "filter-slugify": {
571
- "prefix": "slugify",
572
- "body": "{{ ${1:value}|slugify }}",
573
- "description": "URL-friendly slug"
574
- },
575
- "filter-wordcount": {
576
- "prefix": "wordcount",
577
- "body": "{{ ${1:text}|wordcount }}",
578
- "description": "Count words"
579
- },
580
- "filter-phone2numeric": {
581
- "prefix": "phone2numeric",
582
- "body": "{{ ${1:value}|phone2numeric }}",
583
- "description": "Phone to numeric"
584
- },
585
- "filter-center": {
586
- "prefix": "center",
587
- "body": "{{ ${1:value}|center:${2:10} }}",
588
- "description": "Center text"
589
- },
590
- "filter-ljust": {
591
- "prefix": "ljust",
592
- "body": "{{ ${1:value}|ljust:${2:10} }}",
593
- "description": "Left justify"
594
- },
595
- "filter-rjust": {
596
- "prefix": "rjust",
597
- "body": "{{ ${1:value}|rjust:${2:10} }}",
598
- "description": "Right justify"
599
- },
600
- "filter-stringformat": {
601
- "prefix": "stringformat",
602
- "body": "{{ ${1:value}|stringformat:\"${2:s}\" }}",
603
- "description": "String format"
604
- },
605
- "filter-cut": {
606
- "prefix": "cut",
607
- "body": "{{ ${1:value}|cut:\"${2: }\" }}",
608
- "description": "Remove characters"
609
- },
610
- "filter-addslashes": {
611
- "prefix": "addslashes",
612
- "body": "{{ ${1:value}|addslashes }}",
613
- "description": "Add slashes"
614
- },
615
- "filter-removetags": {
616
- "prefix": "removetags",
617
- "body": "{{ ${1:html}|removetags:\"${2:p,div}\" }}",
618
- "description": "Remove specific tags"
619
- },
620
- "filter-split": {
621
- "prefix": "split",
622
- "body": "{{ ${1:value}|split:\"${2:,}\" }}",
623
- "description": "Split string"
624
- },
625
- "filter-trans": {
626
- "prefix": "trans-filter",
627
- "body": "{{ ${1:value}|trans }}",
628
- "description": "Translate value"
629
- },
630
- "filter-naturalday": {
631
- "prefix": "naturalday",
632
- "body": "{{ ${1:date}|naturalday }}",
633
- "description": "Natural day format"
634
- },
635
- "filter-apnumber": {
636
- "prefix": "apnumber",
637
- "body": "{{ ${1:number}|apnumber }}",
638
- "description": "American English number"
639
- },
640
- "filter-ordinal": {
641
- "prefix": "ordinal",
642
- "body": "{{ ${1:number}|ordinal }}",
643
- "description": "Ordinal (1st, 2nd, etc.)"
644
- },
645
- "filter-intword": {
646
- "prefix": "intword",
647
- "body": "{{ ${1:number}|intword }}",
648
- "description": "Large integer to word"
649
- },
650
- "filter-get-digit": {
651
- "prefix": "get_digit",
652
- "body": "{{ ${1:number}|get_digit:${2:1} }}",
653
- "description": "Get digit by position"
654
- },
655
- "filter-regroup": {
656
- "prefix": "regroup-filter",
657
- "body": "{{ ${1:list}|regroup:\"${2:key}\" }}",
658
- "description": "Regroup list"
659
- },
660
- "for-forloop": {
661
- "prefix": "for-forloop",
662
- "body": [
663
- "{% for ${1:item} in ${2:items} %}",
664
- " {% if forloop.first %}",
665
- " <ul>",
666
- " {% endif %}",
667
- " <li>{{ forloop.counter }}: {{ ${1} }}</li>",
668
- " {% if forloop.last %}",
669
- " </ul>",
670
- " {% endif %}",
671
- "{% endfor %}"
672
- ],
673
- "description": "For loop with first/last detection"
674
- },
675
- "block-wrap": {
676
- "prefix": "block-wrap",
677
- "body": [
678
- "{% block ${1:name} %}",
679
- " $TM_SELECTED_TEXT",
680
- "{% endblock %}"
681
- ],
682
- "description": "Wrap selection in block"
683
- },
684
- "for-wrap": {
685
- "prefix": "for-wrap",
686
- "body": [
687
- "{% for ${1:item} in ${2:items} %}",
688
- " $TM_SELECTED_TEXT",
689
- "{% endfor %}"
690
- ],
691
- "description": "Wrap selection in for loop"
692
- },
693
- "if-wrap": {
694
- "prefix": "if-wrap",
695
- "body": [
696
- "{% if ${1:condition} %}",
697
- " $TM_SELECTED_TEXT",
698
- "{% endif %}"
699
- ],
700
- "description": "Wrap selection in if"
701
- },
702
- "with-wrap": {
703
- "prefix": "with-wrap",
704
- "body": [
705
- "{% with ${1:var} as ${2:alias} %}",
706
- " $TM_SELECTED_TEXT",
707
- "{% endwith %}"
708
- ],
709
- "description": "Wrap selection in with"
710
- },
711
- "filter-wrap": {
712
- "prefix": "filter-wrap",
713
- "body": "${TM_SELECTED_TEXT}|${1:filter}",
714
- "description": "Wrap selection with filter"
715
- }
716
- }
717
- }
1
+ {
2
+ "meta": {
3
+ "name": "miki-template",
4
+ "description": "Comprehensive snippets for miki-template and Django templates"
5
+ },
6
+ "snippets": {
7
+ "if": {
8
+ "prefix": "if",
9
+ "body": [
10
+ "{% if ${1:condition} %}",
11
+ " $2",
12
+ "{% endif %}"
13
+ ],
14
+ "description": "If block"
15
+ },
16
+ "ifelif": {
17
+ "prefix": "ifelif",
18
+ "body": [
19
+ "{% if ${1:condition} %}",
20
+ " $2",
21
+ "{% elif ${3:condition} %}",
22
+ " $4",
23
+ "{% endif %}"
24
+ ],
25
+ "description": "If/elif block"
26
+ },
27
+ "ifelse": {
28
+ "prefix": "ifelse",
29
+ "body": [
30
+ "{% if ${1:condition} %}",
31
+ " $2",
32
+ "{% else %}",
33
+ " $3",
34
+ "{% endif %}"
35
+ ],
36
+ "description": "If/else block"
37
+ },
38
+ "ifelifelse": {
39
+ "prefix": "ifelifelse",
40
+ "body": [
41
+ "{% if ${1:condition} %}",
42
+ " $2",
43
+ "{% elif ${3:condition} %}",
44
+ " $4",
45
+ "{% else %}",
46
+ " $5",
47
+ "{% endif %}"
48
+ ],
49
+ "description": "If/elif/else block"
50
+ },
51
+ "for": {
52
+ "prefix": "for",
53
+ "body": [
54
+ "{% for ${1:item} in ${2:items} %}",
55
+ " $3",
56
+ "{% empty %}",
57
+ " $4",
58
+ "{% endfor %}"
59
+ ],
60
+ "description": "For loop with empty"
61
+ },
62
+ "for-simple": {
63
+ "prefix": "for-simple",
64
+ "body": [
65
+ "{% for ${1:item} in ${2:items} %}",
66
+ " $3",
67
+ "{% endfor %}"
68
+ ],
69
+ "description": "Simple for loop"
70
+ },
71
+ "forloop-counter": {
72
+ "prefix": "forloop",
73
+ "body": [
74
+ "{% for ${1:item} in ${2:items} %}",
75
+ " {{ forloop.counter }}. ${1}",
76
+ "{% endfor %}"
77
+ ],
78
+ "description": "For loop with forloop.counter"
79
+ },
80
+ "forloop-nested": {
81
+ "prefix": "forloop-nested",
82
+ "body": [
83
+ "{% for ${1:outer} in ${2:outers %}",
84
+ " {% for ${3:inner} in ${4:inners} %}",
85
+ " {{ forloop.parentloop.counter }}.{{ forloop.counter }}: {{ ${3} }}",
86
+ " {% endfor %}",
87
+ "{% endfor %}"
88
+ ],
89
+ "description": "Nested for loops with parentloop"
90
+ },
91
+ "for-unpack": {
92
+ "prefix": "for-unpack",
93
+ "body": [
94
+ "{% for ${1:key}, ${2:value} in ${3:dict} %}",
95
+ " {{ ${1} }}: {{ ${2} }}",
96
+ "{% endfor %}"
97
+ ],
98
+ "description": "For loop with tuple unpacking"
99
+ },
100
+ "with": {
101
+ "prefix": "with",
102
+ "body": [
103
+ "{% with ${1:var} as ${2:alias} %}",
104
+ " $3",
105
+ "{% endwith %}"
106
+ ],
107
+ "description": "With block"
108
+ },
109
+ "with-multi": {
110
+ "prefix": "with-multi",
111
+ "body": [
112
+ "{% with ${1:var1}=${2:value1} ${3:var2}=${4:value2} %}",
113
+ " $5",
114
+ "{% endwith %}"
115
+ ],
116
+ "description": "With multiple variables"
117
+ },
118
+ "cycle": {
119
+ "prefix": "cycle",
120
+ "body": "{% cycle '${1:odd}' '${2:even}' %}",
121
+ "description": "Cycle between values"
122
+ },
123
+ "cycle-named": {
124
+ "prefix": "cycle-named",
125
+ "body": "{% cycle '${1:odd}' '${2:even}' as ${3:marker} silent %}",
126
+ "description": "Named cycle with state"
127
+ },
128
+ "firstof": {
129
+ "prefix": "firstof",
130
+ "body": "{% firstof ${1:var1} ${2:var2} \"${3:fallback}\" %}",
131
+ "description": "First truthy value"
132
+ },
133
+ "comment": {
134
+ "prefix": "comment",
135
+ "body": [
136
+ "{% comment %}",
137
+ " $1",
138
+ "{% endcomment %}"
139
+ ],
140
+ "description": "Comment block"
141
+ },
142
+ "comment-inline": {
143
+ "prefix": "comment-inline",
144
+ "body": "{% comment %}$1{% endcomment %}",
145
+ "description": "Inline comment"
146
+ },
147
+ "verbatim": {
148
+ "prefix": "verbatim",
149
+ "body": [
150
+ "{% verbatim %}",
151
+ " $1",
152
+ "{% endverbatim %}"
153
+ ],
154
+ "description": "Raw content (no parsing)"
155
+ },
156
+ "spaceless": {
157
+ "prefix": "spaceless",
158
+ "body": [
159
+ "{% spaceless %}",
160
+ " $1",
161
+ "{% endspaceless %}"
162
+ ],
163
+ "description": "Remove whitespace"
164
+ },
165
+ "autoescape": {
166
+ "prefix": "autoescape",
167
+ "body": [
168
+ "{% autoescape ${1:on} %}",
169
+ " $2",
170
+ "{% endautoescape %}"
171
+ ],
172
+ "description": "Autoescape block"
173
+ },
174
+ "block": {
175
+ "prefix": "block",
176
+ "body": [
177
+ "{% block ${1:name} %}",
178
+ " $2",
179
+ "{% endblock %}"
180
+ ],
181
+ "description": "Block definition"
182
+ },
183
+ "block-super": {
184
+ "prefix": "block-super",
185
+ "body": [
186
+ "{% block ${1:name} %}",
187
+ " {{ block.super }}",
188
+ " $2",
189
+ "{% endblock %}"
190
+ ],
191
+ "description": "Block with block.super"
192
+ },
193
+ "extends": {
194
+ "prefix": "extends",
195
+ "body": "{% extends \"${1:base.html}\" %}",
196
+ "description": "Extend parent template"
197
+ },
198
+ "include": {
199
+ "prefix": "include",
200
+ "body": "{% include \"${1:template.html}\" %}",
201
+ "description": "Include template"
202
+ },
203
+ "include-with": {
204
+ "prefix": "include-with",
205
+ "body": "{% include \"${1:template.html}\" with ${2:var}=${3:value} %}",
206
+ "description": "Include with context"
207
+ },
208
+ "include-only": {
209
+ "prefix": "include-only",
210
+ "body": "{% include \"${1:template.html}\" only %}",
211
+ "description": "Include without context"
212
+ },
213
+ "partialdef": {
214
+ "prefix": "partialdef",
215
+ "body": [
216
+ "{% partialdef ${1:name} %}",
217
+ " $2",
218
+ "{% endpartialdef %}"
219
+ ],
220
+ "description": "Define partial template"
221
+ },
222
+ "partialdef-inline": {
223
+ "prefix": "partialdef-inline",
224
+ "body": [
225
+ "{% partialdef ${1:name} inline %}",
226
+ " $2",
227
+ "{% endpartialdef %}"
228
+ ],
229
+ "description": "Define inline partial"
230
+ },
231
+ "partialdef-lazy": {
232
+ "prefix": "partialdef-lazy",
233
+ "body": [
234
+ "{% partialdef ${1:name} lazy %}",
235
+ " $2",
236
+ "{% endpartialdef %}"
237
+ ],
238
+ "description": "Define lazy partial"
239
+ },
240
+ "partial": {
241
+ "prefix": "partial",
242
+ "body": "{% partial ${1:name} %}",
243
+ "description": "Render partial"
244
+ },
245
+ "partial-with": {
246
+ "prefix": "partial-with",
247
+ "body": "{% partial ${1:name} with ${2:var}=${3:value} %}",
248
+ "description": "Render partial with context"
249
+ },
250
+ "load": {
251
+ "prefix": "load",
252
+ "body": "{% load ${1:i18n} %}",
253
+ "description": "Load tag library"
254
+ },
255
+ "trans": {
256
+ "prefix": "trans",
257
+ "body": "{% trans \"${1:Hello, World!}\" %}",
258
+ "description": "Translate string"
259
+ },
260
+ "trans-var": {
261
+ "prefix": "trans-var",
262
+ "body": "{% trans \"${1:Hello, %s!}\" ${2:var} %}",
263
+ "description": "Translate with variable"
264
+ },
265
+ "blocktrans": {
266
+ "prefix": "blocktrans",
267
+ "body": [
268
+ "{% blocktrans with ${1:name}=${2:value} %}",
269
+ " $3",
270
+ "{% endblocktrans %}"
271
+ ],
272
+ "description": "Translate block"
273
+ },
274
+ "blocktrans-plural": {
275
+ "prefix": "blocktrans-plural",
276
+ "body": [
277
+ "{% blocktrans with ${1:name}=${2:value} count ${3:n}=${4:items|length %}",
278
+ " {{ name }} has {{ ${3} }} item.",
279
+ "{% plural %}",
280
+ " {{ name }} has {{ ${3} }} items.",
281
+ "{% endblocktrans %}"
282
+ ],
283
+ "description": "Translate block with plural"
284
+ },
285
+ "language": {
286
+ "prefix": "language",
287
+ "body": [
288
+ "{% language \"${1:fr}\" %}",
289
+ " $2",
290
+ "{% endlanguage %}"
291
+ ],
292
+ "description": "Switch language"
293
+ },
294
+ "regroup": {
295
+ "prefix": "regroup",
296
+ "body": [
297
+ "{% regroup ${1:items} by ${2:attribute} as ${3:groups} %}",
298
+ "{% for ${4:group} in ${3} %}",
299
+ " <h3>{{ ${4}.grouper }}</h3>",
300
+ "{% endfor %}"
301
+ ],
302
+ "description": "Regroup by attribute"
303
+ },
304
+ "cache": {
305
+ "prefix": "cache",
306
+ "body": [
307
+ "{% cache ${1:timeout} ${2:key} %}",
308
+ " $3",
309
+ "{% endcache %}"
310
+ ],
311
+ "description": "Cache block"
312
+ },
313
+ "filter-block": {
314
+ "prefix": "filter-block",
315
+ "body": [
316
+ "{% filter ${1:lower} %}",
317
+ " $2",
318
+ "{% endfilter %}"
319
+ ],
320
+ "description": "Filter block"
321
+ },
322
+ "widthratio": {
323
+ "prefix": "widthratio",
324
+ "body": "{% widthratio ${1:value} ${2:max} ${3:max_width} %}",
325
+ "description": "Proportional width"
326
+ },
327
+ "csrf": {
328
+ "prefix": "csrf",
329
+ "body": "{% csrf_token %}",
330
+ "description": "CSRF token"
331
+ },
332
+ "csp": {
333
+ "prefix": "csp",
334
+ "body": "<script {% csp_nonce_attr %}>$1</script>",
335
+ "description": "CSP nonce attribute"
336
+ },
337
+ "static": {
338
+ "prefix": "static",
339
+ "body": "{% static \"${1:css/app.css}\" %}",
340
+ "description": "Static file URL"
341
+ },
342
+ "url": {
343
+ "prefix": "url",
344
+ "body": "{% url \"${1:route}\" %}",
345
+ "description": "URL by name"
346
+ },
347
+ "url-args": {
348
+ "prefix": "url-args",
349
+ "body": "{% url \"${1:route}\" ${2:arg1} ${3:arg2} %}",
350
+ "description": "URL with positional args"
351
+ },
352
+ "url-kwargs": {
353
+ "prefix": "url-kwargs",
354
+ "body": "{% url \"${1:route}\" ${2:key}=${3:value} %}",
355
+ "description": "URL with keyword args"
356
+ },
357
+ "debug": {
358
+ "prefix": "debug",
359
+ "body": "{% debug %}",
360
+ "description": "Debug output"
361
+ },
362
+ "templatetag": {
363
+ "prefix": "templatetag",
364
+ "body": "{% templatetag ${1|openblock|closeblock|openvariable|closevariable|openbrace|closebrace|opencomment|closecomment} %}",
365
+ "description": "Render template tag symbol"
366
+ },
367
+ "addtoblock": {
368
+ "prefix": "addtoblock",
369
+ "body": [
370
+ "{% addtoblock ${1:css %}",
371
+ " $2",
372
+ "{% endaddtoblock %}"
373
+ ],
374
+ "description": "Add content to block"
375
+ },
376
+ "prettier-ignore": {
377
+ "prefix": "prettier-ignore",
378
+ "body": "{# prettier-ignore #}",
379
+ "description": "Prettier ignore (single line)"
380
+ },
381
+ "prettier-ignore-start": {
382
+ "prefix": "prettier-ignore-start",
383
+ "body": [
384
+ "{# prettier-ignore-start #}",
385
+ "$1",
386
+ "{# prettier-ignore-end #}"
387
+ ],
388
+ "description": "Prettier ignore region"
389
+ },
390
+ "filter-upper": {
391
+ "prefix": "upper",
392
+ "body": "{{ ${1:value}|upper }}",
393
+ "description": "Convert to uppercase"
394
+ },
395
+ "filter-lower": {
396
+ "prefix": "lower",
397
+ "body": "{{ ${1:value}|lower }}",
398
+ "description": "Convert to lowercase"
399
+ },
400
+ "filter-title": {
401
+ "prefix": "title",
402
+ "body": "{{ ${1:value}|title }}",
403
+ "description": "Title case"
404
+ },
405
+ "filter-capfirst": {
406
+ "prefix": "capfirst",
407
+ "body": "{{ ${1:value}|capfirst }}",
408
+ "description": "Capitalize first letter"
409
+ },
410
+ "filter-default": {
411
+ "prefix": "default",
412
+ "body": "{{ ${1:value}|default:\"${2:fallback}\" }}",
413
+ "description": "Default value if falsy"
414
+ },
415
+ "filter-default-if-none": {
416
+ "prefix": "default_if_none",
417
+ "body": "{{ ${1:value}|default_if_none:\"${2:fallback}\" }}",
418
+ "description": "Default if None/undefined"
419
+ },
420
+ "filter-length": {
421
+ "prefix": "length",
422
+ "body": "{{ ${1:value}|length }}",
423
+ "description": "Length of value"
424
+ },
425
+ "filter-slice": {
426
+ "prefix": "slice",
427
+ "body": "{{ ${1:value}|slice:\"${2:0:3}\" }}",
428
+ "description": "Slice array/string"
429
+ },
430
+ "filter-join": {
431
+ "prefix": "join",
432
+ "body": "{{ ${1:list}|join:\"${2:, }\" }}",
433
+ "description": "Join array elements"
434
+ },
435
+ "filter-first": {
436
+ "prefix": "first",
437
+ "body": "{{ ${1:list}|first }}",
438
+ "description": "First element"
439
+ },
440
+ "filter-last": {
441
+ "prefix": "last",
442
+ "body": "{{ ${1:list}|last }}",
443
+ "description": "Last element"
444
+ },
445
+ "filter-truncatewords": {
446
+ "prefix": "truncatewords",
447
+ "body": "{{ ${1:text}|truncatewords:${2:10} }}",
448
+ "description": "Truncate by words"
449
+ },
450
+ "filter-truncatechars": {
451
+ "prefix": "truncatechars",
452
+ "body": "{{ ${1:text}|truncatechars:${2:100} }}",
453
+ "description": "Truncate by characters"
454
+ },
455
+ "filter-striptags": {
456
+ "prefix": "striptags",
457
+ "body": "{{ ${1:html}|striptags }}",
458
+ "description": "Strip HTML tags"
459
+ },
460
+ "filter-safe": {
461
+ "prefix": "safe",
462
+ "body": "{{ ${1:html}|safe }}",
463
+ "description": "Mark as HTML safe"
464
+ },
465
+ "filter-escape": {
466
+ "prefix": "escape",
467
+ "body": "{{ ${1:value}|escape }}",
468
+ "description": "Escape HTML"
469
+ },
470
+ "filter-linebreaks": {
471
+ "prefix": "linebreaks",
472
+ "body": "{{ ${1:text}|linebreaks }}",
473
+ "description": "Convert line breaks to HTML"
474
+ },
475
+ "filter-date": {
476
+ "prefix": "date",
477
+ "body": "{{ ${1:date}|date:\"${2:Y-m-d}\" }}",
478
+ "description": "Format date"
479
+ },
480
+ "filter-time": {
481
+ "prefix": "time",
482
+ "body": "{{ ${1:date}|time:\"${2:H:i}\" }}",
483
+ "description": "Format time"
484
+ },
485
+ "filter-add": {
486
+ "prefix": "add",
487
+ "body": "{{ ${1:value}|add:${2:1} }}",
488
+ "description": "Add value"
489
+ },
490
+ "filter-floatformat": {
491
+ "prefix": "floatformat",
492
+ "body": "{{ ${1:value}|floatformat:${2:2} }}",
493
+ "description": "Format decimal"
494
+ },
495
+ "filter-divisibleby": {
496
+ "prefix": "divisibleby",
497
+ "body": "{{ ${1:value}|divisibleby:${2:2} }}",
498
+ "description": "Check divisibility"
499
+ },
500
+ "filter-mod": {
501
+ "prefix": "mod",
502
+ "body": "{{ ${1:value}|mod:${2:2} }}",
503
+ "description": "Modulo operation"
504
+ },
505
+ "filter-with": {
506
+ "prefix": "with-filter",
507
+ "body": "{{ ${1:value}|with:${2:var}=${3:value} }}",
508
+ "description": "Add context to value"
509
+ },
510
+ "filter-json-script": {
511
+ "prefix": "json_script",
512
+ "body": "{{ ${1:data}|json_script:${2:'id'} }}",
513
+ "description": "JSON script tag"
514
+ },
515
+ "filter-urlencode": {
516
+ "prefix": "urlencode",
517
+ "body": "{{ ${1:value}|urlencode }}",
518
+ "description": "URL encode"
519
+ },
520
+ "filter-yesno": {
521
+ "prefix": "yesno",
522
+ "body": "{{ ${1:value}|yesno:\"${2:yes,no,maybe}\" }}",
523
+ "description": "Yes/No/Maybe mapping"
524
+ },
525
+ "filter-pluralize": {
526
+ "prefix": "pluralize",
527
+ "body": "{{ ${1:count}|pluralize }}",
528
+ "description": "Pluralize suffix"
529
+ },
530
+ "filter-pluralize-custom": {
531
+ "prefix": "pluralize-custom",
532
+ "body": "{{ ${1:count}|pluralize:\"${2:y,ies}\" }}",
533
+ "description": "Custom plural suffix"
534
+ },
535
+ "filter-filesizeformat": {
536
+ "prefix": "filesizeformat",
537
+ "body": "{{ ${1:bytes}|filesizeformat }}",
538
+ "description": "Format file size"
539
+ },
540
+ "filter-intcomma": {
541
+ "prefix": "intcomma",
542
+ "body": "{{ ${1:number}|intcomma }}",
543
+ "description": "Integer with commas"
544
+ },
545
+ "filter-timesince": {
546
+ "prefix": "timesince",
547
+ "body": "{{ ${1:date}|timesince }}",
548
+ "description": "Time since"
549
+ },
550
+ "filter-timeuntil": {
551
+ "prefix": "timeuntil",
552
+ "body": "{{ ${1:date}|timeuntil }}",
553
+ "description": "Time until"
554
+ },
555
+ "filter-strftime": {
556
+ "prefix": "strftime",
557
+ "body": "{{ ${1:date}|strftime:\"${2:PPpp}\" }}",
558
+ "description": "Format with date-fns"
559
+ },
560
+ "filter-dictsort": {
561
+ "prefix": "dictsort",
562
+ "body": "{{ ${1:list}|dictsort:\"${2:key}\" }}",
563
+ "description": "Sort by key"
564
+ },
565
+ "filter-dictsortreversed": {
566
+ "prefix": "dictsortreversed",
567
+ "body": "{{ ${1:list}|dictsortreversed:\"${2:key}\" }}",
568
+ "description": "Sort by key (reversed)"
569
+ },
570
+ "filter-slugify": {
571
+ "prefix": "slugify",
572
+ "body": "{{ ${1:value}|slugify }}",
573
+ "description": "URL-friendly slug"
574
+ },
575
+ "filter-wordcount": {
576
+ "prefix": "wordcount",
577
+ "body": "{{ ${1:text}|wordcount }}",
578
+ "description": "Count words"
579
+ },
580
+ "filter-phone2numeric": {
581
+ "prefix": "phone2numeric",
582
+ "body": "{{ ${1:value}|phone2numeric }}",
583
+ "description": "Phone to numeric"
584
+ },
585
+ "filter-center": {
586
+ "prefix": "center",
587
+ "body": "{{ ${1:value}|center:${2:10} }}",
588
+ "description": "Center text"
589
+ },
590
+ "filter-ljust": {
591
+ "prefix": "ljust",
592
+ "body": "{{ ${1:value}|ljust:${2:10} }}",
593
+ "description": "Left justify"
594
+ },
595
+ "filter-rjust": {
596
+ "prefix": "rjust",
597
+ "body": "{{ ${1:value}|rjust:${2:10} }}",
598
+ "description": "Right justify"
599
+ },
600
+ "filter-stringformat": {
601
+ "prefix": "stringformat",
602
+ "body": "{{ ${1:value}|stringformat:\"${2:s}\" }}",
603
+ "description": "String format"
604
+ },
605
+ "filter-cut": {
606
+ "prefix": "cut",
607
+ "body": "{{ ${1:value}|cut:\"${2: }\" }}",
608
+ "description": "Remove characters"
609
+ },
610
+ "filter-addslashes": {
611
+ "prefix": "addslashes",
612
+ "body": "{{ ${1:value}|addslashes }}",
613
+ "description": "Add slashes"
614
+ },
615
+ "filter-removetags": {
616
+ "prefix": "removetags",
617
+ "body": "{{ ${1:html}|removetags:\"${2:p,div}\" }}",
618
+ "description": "Remove specific tags"
619
+ },
620
+ "filter-split": {
621
+ "prefix": "split",
622
+ "body": "{{ ${1:value}|split:\"${2:,}\" }}",
623
+ "description": "Split string"
624
+ },
625
+ "filter-trans": {
626
+ "prefix": "trans-filter",
627
+ "body": "{{ ${1:value}|trans }}",
628
+ "description": "Translate value"
629
+ },
630
+ "filter-naturalday": {
631
+ "prefix": "naturalday",
632
+ "body": "{{ ${1:date}|naturalday }}",
633
+ "description": "Natural day format"
634
+ },
635
+ "filter-apnumber": {
636
+ "prefix": "apnumber",
637
+ "body": "{{ ${1:number}|apnumber }}",
638
+ "description": "American English number"
639
+ },
640
+ "filter-ordinal": {
641
+ "prefix": "ordinal",
642
+ "body": "{{ ${1:number}|ordinal }}",
643
+ "description": "Ordinal (1st, 2nd, etc.)"
644
+ },
645
+ "filter-intword": {
646
+ "prefix": "intword",
647
+ "body": "{{ ${1:number}|intword }}",
648
+ "description": "Large integer to word"
649
+ },
650
+ "filter-get-digit": {
651
+ "prefix": "get_digit",
652
+ "body": "{{ ${1:number}|get_digit:${2:1} }}",
653
+ "description": "Get digit by position"
654
+ },
655
+ "filter-regroup": {
656
+ "prefix": "regroup-filter",
657
+ "body": "{{ ${1:list}|regroup:\"${2:key}\" }}",
658
+ "description": "Regroup list"
659
+ },
660
+ "for-forloop": {
661
+ "prefix": "for-forloop",
662
+ "body": [
663
+ "{% for ${1:item} in ${2:items} %}",
664
+ " {% if forloop.first %}",
665
+ " <ul>",
666
+ " {% endif %}",
667
+ " <li>{{ forloop.counter }}: {{ ${1} }}</li>",
668
+ " {% if forloop.last %}",
669
+ " </ul>",
670
+ " {% endif %}",
671
+ "{% endfor %}"
672
+ ],
673
+ "description": "For loop with first/last detection"
674
+ },
675
+ "block-wrap": {
676
+ "prefix": "block-wrap",
677
+ "body": [
678
+ "{% block ${1:name} %}",
679
+ " $TM_SELECTED_TEXT",
680
+ "{% endblock %}"
681
+ ],
682
+ "description": "Wrap selection in block"
683
+ },
684
+ "for-wrap": {
685
+ "prefix": "for-wrap",
686
+ "body": [
687
+ "{% for ${1:item} in ${2:items} %}",
688
+ " $TM_SELECTED_TEXT",
689
+ "{% endfor %}"
690
+ ],
691
+ "description": "Wrap selection in for loop"
692
+ },
693
+ "if-wrap": {
694
+ "prefix": "if-wrap",
695
+ "body": [
696
+ "{% if ${1:condition} %}",
697
+ " $TM_SELECTED_TEXT",
698
+ "{% endif %}"
699
+ ],
700
+ "description": "Wrap selection in if"
701
+ },
702
+ "with-wrap": {
703
+ "prefix": "with-wrap",
704
+ "body": [
705
+ "{% with ${1:var} as ${2:alias} %}",
706
+ " $TM_SELECTED_TEXT",
707
+ "{% endwith %}"
708
+ ],
709
+ "description": "Wrap selection in with"
710
+ },
711
+ "filter-wrap": {
712
+ "prefix": "filter-wrap",
713
+ "body": "${TM_SELECTED_TEXT}|${1:filter}",
714
+ "description": "Wrap selection with filter"
715
+ }
716
+ }
717
+ }