miki-template 2.3.1 → 2.3.3

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 (167) hide show
  1. package/README.md +1 -1
  2. package/package.json +24 -2
  3. package/src/codegen.js +140 -9
  4. package/src/parser.js +69 -1
  5. package/src/tags/control.js +112 -51
  6. package/src/tags/extra.js +4 -17
  7. package/src/tags/i18n.js +6 -17
  8. package/src/tags/inheritance.js +6 -20
  9. package/src/tags/util.js +5 -20
  10. package/.eslintrc.json +0 -16
  11. package/.github/release-notes/v1.3.1.md +0 -55
  12. package/.github/release-notes/v1.3.3.md +0 -77
  13. package/.github/release-notes/v1.3.7.md +0 -20
  14. package/.github/workflows/ci.yml +0 -42
  15. package/.github/workflows/docs.yml +0 -107
  16. package/.github/workflows/release.yml +0 -107
  17. package/AGENT.md +0 -71
  18. package/API_REFERENCE.md +0 -341
  19. package/CHANGELOG.md +0 -173
  20. package/CODE_OF_CONDUCT.md +0 -14
  21. package/CONTRIBUTING.md +0 -27
  22. package/ROADMAP.md +0 -40
  23. package/assets/banner.png +0 -0
  24. package/assets/logo.png +0 -0
  25. package/benchmarks/ejs-results.json +0 -17
  26. package/benchmarks/ejs.js +0 -38
  27. package/benchmarks/handlebars-results.json +0 -17
  28. package/benchmarks/handlebars.js +0 -45
  29. package/benchmarks/miki-results.json +0 -17
  30. package/benchmarks/miki.js +0 -39
  31. package/benchmarks/pug-results.json +0 -17
  32. package/benchmarks/pug.js +0 -38
  33. package/benchmarks/report.json +0 -17
  34. package/benchmarks/run.js +0 -81
  35. package/benchmarks/stress.mjs +0 -647
  36. package/benchmarks/templates/large.dtpl +0 -7
  37. package/benchmarks/templates/medium.dtpl +0 -3
  38. package/benchmarks/templates/small.dtpl +0 -7
  39. package/context/component.md +0 -109
  40. package/context/prd.md +0 -131
  41. package/context/project-structure.md +0 -33
  42. package/dir/base.html +0 -23
  43. package/dir/cmpnt.html +0 -11
  44. package/dir/footer.html +0 -3
  45. package/dir/home.html +0 -80
  46. package/dir/index.html +0 -80
  47. package/dir/navbar.html +0 -9
  48. package/docs/api/async-render.md +0 -170
  49. package/docs/api/cache.md +0 -174
  50. package/docs/api/compile.md +0 -256
  51. package/docs/api/context-processors.md +0 -154
  52. package/docs/api/filters.md +0 -437
  53. package/docs/api/finder.md +0 -188
  54. package/docs/api/helpers.md +0 -106
  55. package/docs/api/i18n.md +0 -314
  56. package/docs/api/index.md +0 -108
  57. package/docs/api/libraries.md +0 -414
  58. package/docs/api/render-partial.md +0 -162
  59. package/docs/api/render.md +0 -184
  60. package/docs/api/security.md +0 -290
  61. package/docs/api/setup-express.md +0 -152
  62. package/docs/api/tags.md +0 -268
  63. package/docs/assets/banner.png +0 -0
  64. package/docs/assets/logo.png +0 -0
  65. package/docs/filter.md +0 -0
  66. package/docs/guide/advanced-usage.md +0 -794
  67. package/docs/guide/async-rendering.md +0 -616
  68. package/docs/guide/context-processors.md +0 -514
  69. package/docs/guide/custom-filters.md +0 -622
  70. package/docs/guide/custom-tags.md +0 -542
  71. package/docs/guide/filters.md +0 -1314
  72. package/docs/guide/getting-started.md +0 -204
  73. package/docs/guide/installation.md +0 -190
  74. package/docs/guide/partial-templates.md +0 -734
  75. package/docs/guide/quick-start.md +0 -444
  76. package/docs/guide/security.md +0 -690
  77. package/docs/guide/tags.md +0 -1566
  78. package/docs/guide/template-discovery.md +0 -340
  79. package/docs/guide/template-inheritance.md +0 -546
  80. package/docs/guide/what-is-miki-template.md +0 -28
  81. package/docs/guide/why-miki-template.md +0 -75
  82. package/docs/index.md +0 -86
  83. package/docs/integrations/elysia.md +0 -80
  84. package/docs/integrations/express.md +0 -219
  85. package/docs/integrations/fastify.md +0 -79
  86. package/docs/integrations/hono.md +0 -80
  87. package/docs/integrations/index.md +0 -68
  88. package/docs/integrations/koa.md +0 -90
  89. package/docs/integrations/nestjs.md +0 -80
  90. package/docs/integrations/tsed.md +0 -83
  91. package/docs/performance.md +0 -74
  92. package/eslint.config.mjs +0 -42
  93. package/ex.mjs +0 -36
  94. package/live-test/integrations/elysia-example.js +0 -16
  95. package/live-test/integrations/express-example.js +0 -24
  96. package/live-test/integrations/fastify-example.js +0 -20
  97. package/live-test/integrations/hono-example.js +0 -16
  98. package/live-test/integrations/koa-example.js +0 -30
  99. package/live-test/integrations/nestjs-example.js +0 -25
  100. package/live-test/integrations/smoke-test.js +0 -166
  101. package/live-test/integrations/tsed-example.js +0 -23
  102. package/live-test/package-lock.json +0 -1150
  103. package/live-test/package.json +0 -13
  104. package/live-test/packages/product/templates/product/detail.html +0 -7
  105. package/live-test/server.js +0 -38
  106. package/live-test/templates/app_templates/detail.html +0 -6
  107. package/live-test/views/base.html +0 -8
  108. package/live-test/views/child.html +0 -7
  109. package/live-test/views/home.html +0 -17
  110. package/live-test/views/index.html +0 -1
  111. package/miki-template-extension/.github/workflows/ci.yml +0 -116
  112. package/miki-template-extension/.vscodeignore +0 -7
  113. package/miki-template-extension/CHANGELOG.md +0 -99
  114. package/miki-template-extension/LICENSE +0 -21
  115. package/miki-template-extension/README.md +0 -273
  116. package/miki-template-extension/extension.js +0 -1013
  117. package/miki-template-extension/icon.png +0 -0
  118. package/miki-template-extension/icon.svg +0 -10
  119. package/miki-template-extension/miki-template-1.7.1.vsix +0 -0
  120. package/miki-template-extension/package.json +0 -280
  121. package/miki-template-extension/snippets/miki-template.json +0 -717
  122. package/miki-template-extension/syntaxes/language-configuration.json +0 -114
  123. package/miki-template-extension/syntaxes/miki-template.tmLanguage.json +0 -355
  124. package/miki-template-extension/tests/grammar-tests.json +0 -162
  125. package/miki-template-extension/tests/run-grammar-tests.js +0 -82
  126. package/mkdocs.yml +0 -195
  127. package/overrides/main.html +0 -26
  128. package/requirements-docs.txt +0 -2
  129. package/sample-app/package-lock.json +0 -901
  130. package/sample-app/package.json +0 -9
  131. package/sample-app/server.js +0 -14
  132. package/sample-app/views/index.html +0 -1
  133. package/scripts/build-vsix.js +0 -129
  134. package/scripts/build-vsix.ps1 +0 -15
  135. package/snippets/miki-template.json +0 -177
  136. package/src/asyncRender.js +0 -21
  137. package/src/types.d.ts +0 -107
  138. package/syntaxes/language-configuration.json +0 -26
  139. package/syntaxes/miki-template.tmLanguage.json +0 -146
  140. package/tests/asyncRender.test.js +0 -17
  141. package/tests/base.html +0 -6
  142. package/tests/child.html +0 -3
  143. package/tests/context_processors.test.js +0 -13
  144. package/tests/esm.test.mjs +0 -61
  145. package/tests/filters.test.js +0 -263
  146. package/tests/finder-appdirs.test.js +0 -19
  147. package/tests/finder.test.js +0 -17
  148. package/tests/fixtures/views/nested/index.html +0 -1
  149. package/tests/fixtures/views/partial.html +0 -1
  150. package/tests/fixtures/views/sub/deepfile.html +0 -1
  151. package/tests/fixtures/views-appdirs/product/site/detail.html +0 -1
  152. package/tests/include_security.test.js +0 -9
  153. package/tests/integration/README.md +0 -32
  154. package/tests/integration/features.test.cjs +0 -1681
  155. package/tests/integration/features.test.mjs +0 -1697
  156. package/tests/integration/finder.esm.test.mjs +0 -13
  157. package/tests/integration/partial-render.test.cjs +0 -13
  158. package/tests/integration/templates/base.miki +0 -6
  159. package/tests/integration/templates/child.miki +0 -6
  160. package/tests/integration/templates/index.html +0 -17
  161. package/tests/lexer.test.js +0 -45
  162. package/tests/parser.test.js +0 -57
  163. package/tests/partial.html +0 -1
  164. package/tests/partialdef.test.js +0 -79
  165. package/tests/production_checks.js +0 -57
  166. package/tests/security.test.js +0 -28
  167. package/tests/tags.test.js +0 -233
@@ -1,717 +0,0 @@
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
- }