miki-template 2.3.1 → 2.3.2
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.
- package/package.json +45 -1
- package/.eslintrc.json +0 -16
- package/.github/release-notes/v1.3.1.md +0 -55
- package/.github/release-notes/v1.3.3.md +0 -77
- package/.github/release-notes/v1.3.7.md +0 -20
- package/.github/workflows/ci.yml +0 -42
- package/.github/workflows/docs.yml +0 -107
- package/.github/workflows/release.yml +0 -107
- package/AGENT.md +0 -71
- package/API_REFERENCE.md +0 -341
- package/CHANGELOG.md +0 -173
- package/CODE_OF_CONDUCT.md +0 -14
- package/CONTRIBUTING.md +0 -27
- package/ROADMAP.md +0 -40
- package/assets/banner.png +0 -0
- package/assets/logo.png +0 -0
- package/benchmarks/ejs-results.json +0 -17
- package/benchmarks/ejs.js +0 -38
- package/benchmarks/handlebars-results.json +0 -17
- package/benchmarks/handlebars.js +0 -45
- package/benchmarks/miki-results.json +0 -17
- package/benchmarks/miki.js +0 -39
- package/benchmarks/pug-results.json +0 -17
- package/benchmarks/pug.js +0 -38
- package/benchmarks/report.json +0 -17
- package/benchmarks/run.js +0 -81
- package/benchmarks/stress.mjs +0 -647
- package/benchmarks/templates/large.dtpl +0 -7
- package/benchmarks/templates/medium.dtpl +0 -3
- package/benchmarks/templates/small.dtpl +0 -7
- package/context/component.md +0 -109
- package/context/prd.md +0 -131
- package/context/project-structure.md +0 -33
- package/dir/base.html +0 -23
- package/dir/cmpnt.html +0 -11
- package/dir/footer.html +0 -3
- package/dir/home.html +0 -80
- package/dir/index.html +0 -80
- package/dir/navbar.html +0 -9
- package/docs/api/async-render.md +0 -170
- package/docs/api/cache.md +0 -174
- package/docs/api/compile.md +0 -256
- package/docs/api/context-processors.md +0 -154
- package/docs/api/filters.md +0 -437
- package/docs/api/finder.md +0 -188
- package/docs/api/helpers.md +0 -106
- package/docs/api/i18n.md +0 -314
- package/docs/api/index.md +0 -108
- package/docs/api/libraries.md +0 -414
- package/docs/api/render-partial.md +0 -162
- package/docs/api/render.md +0 -184
- package/docs/api/security.md +0 -290
- package/docs/api/setup-express.md +0 -152
- package/docs/api/tags.md +0 -268
- package/docs/assets/banner.png +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/filter.md +0 -0
- package/docs/guide/advanced-usage.md +0 -794
- package/docs/guide/async-rendering.md +0 -616
- package/docs/guide/context-processors.md +0 -514
- package/docs/guide/custom-filters.md +0 -622
- package/docs/guide/custom-tags.md +0 -542
- package/docs/guide/filters.md +0 -1314
- package/docs/guide/getting-started.md +0 -204
- package/docs/guide/installation.md +0 -190
- package/docs/guide/partial-templates.md +0 -734
- package/docs/guide/quick-start.md +0 -444
- package/docs/guide/security.md +0 -690
- package/docs/guide/tags.md +0 -1566
- package/docs/guide/template-discovery.md +0 -340
- package/docs/guide/template-inheritance.md +0 -546
- package/docs/guide/what-is-miki-template.md +0 -28
- package/docs/guide/why-miki-template.md +0 -75
- package/docs/index.md +0 -86
- package/docs/integrations/elysia.md +0 -80
- package/docs/integrations/express.md +0 -219
- package/docs/integrations/fastify.md +0 -79
- package/docs/integrations/hono.md +0 -80
- package/docs/integrations/index.md +0 -68
- package/docs/integrations/koa.md +0 -90
- package/docs/integrations/nestjs.md +0 -80
- package/docs/integrations/tsed.md +0 -83
- package/docs/performance.md +0 -74
- package/eslint.config.mjs +0 -42
- package/ex.mjs +0 -36
- package/live-test/integrations/elysia-example.js +0 -16
- package/live-test/integrations/express-example.js +0 -24
- package/live-test/integrations/fastify-example.js +0 -20
- package/live-test/integrations/hono-example.js +0 -16
- package/live-test/integrations/koa-example.js +0 -30
- package/live-test/integrations/nestjs-example.js +0 -25
- package/live-test/integrations/smoke-test.js +0 -166
- package/live-test/integrations/tsed-example.js +0 -23
- package/live-test/package-lock.json +0 -1150
- package/live-test/package.json +0 -13
- package/live-test/packages/product/templates/product/detail.html +0 -7
- package/live-test/server.js +0 -38
- package/live-test/templates/app_templates/detail.html +0 -6
- package/live-test/views/base.html +0 -8
- package/live-test/views/child.html +0 -7
- package/live-test/views/home.html +0 -17
- package/live-test/views/index.html +0 -1
- package/miki-template-extension/.github/workflows/ci.yml +0 -116
- package/miki-template-extension/.vscodeignore +0 -7
- package/miki-template-extension/CHANGELOG.md +0 -99
- package/miki-template-extension/LICENSE +0 -21
- package/miki-template-extension/README.md +0 -273
- package/miki-template-extension/extension.js +0 -1013
- package/miki-template-extension/icon.png +0 -0
- package/miki-template-extension/icon.svg +0 -10
- package/miki-template-extension/miki-template-1.7.1.vsix +0 -0
- package/miki-template-extension/package.json +0 -280
- package/miki-template-extension/snippets/miki-template.json +0 -717
- package/miki-template-extension/syntaxes/language-configuration.json +0 -114
- package/miki-template-extension/syntaxes/miki-template.tmLanguage.json +0 -355
- package/miki-template-extension/tests/grammar-tests.json +0 -162
- package/miki-template-extension/tests/run-grammar-tests.js +0 -82
- package/mkdocs.yml +0 -195
- package/overrides/main.html +0 -26
- package/requirements-docs.txt +0 -2
- package/sample-app/package-lock.json +0 -901
- package/sample-app/package.json +0 -9
- package/sample-app/server.js +0 -14
- package/sample-app/views/index.html +0 -1
- package/scripts/build-vsix.js +0 -129
- package/scripts/build-vsix.ps1 +0 -15
- package/snippets/miki-template.json +0 -177
- package/src/asyncRender.js +0 -21
- package/src/types.d.ts +0 -107
- package/syntaxes/language-configuration.json +0 -26
- package/syntaxes/miki-template.tmLanguage.json +0 -146
- package/tests/asyncRender.test.js +0 -17
- package/tests/base.html +0 -6
- package/tests/child.html +0 -3
- package/tests/context_processors.test.js +0 -13
- package/tests/esm.test.mjs +0 -61
- package/tests/filters.test.js +0 -263
- package/tests/finder-appdirs.test.js +0 -19
- package/tests/finder.test.js +0 -17
- package/tests/fixtures/views/nested/index.html +0 -1
- package/tests/fixtures/views/partial.html +0 -1
- package/tests/fixtures/views/sub/deepfile.html +0 -1
- package/tests/fixtures/views-appdirs/product/site/detail.html +0 -1
- package/tests/include_security.test.js +0 -9
- package/tests/integration/README.md +0 -32
- package/tests/integration/features.test.cjs +0 -1681
- package/tests/integration/features.test.mjs +0 -1697
- package/tests/integration/finder.esm.test.mjs +0 -13
- package/tests/integration/partial-render.test.cjs +0 -13
- package/tests/integration/templates/base.miki +0 -6
- package/tests/integration/templates/child.miki +0 -6
- package/tests/integration/templates/index.html +0 -17
- package/tests/lexer.test.js +0 -45
- package/tests/parser.test.js +0 -57
- package/tests/partial.html +0 -1
- package/tests/partialdef.test.js +0 -79
- package/tests/production_checks.js +0 -57
- package/tests/security.test.js +0 -28
- package/tests/tags.test.js +0 -233
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"comments": {
|
|
3
|
-
"lineComment": "{#",
|
|
4
|
-
"blockComment": ["{#", "#}"]
|
|
5
|
-
},
|
|
6
|
-
"brackets": [
|
|
7
|
-
["{%", "%}"],
|
|
8
|
-
["{{", "}}"],
|
|
9
|
-
["{#", "#}"],
|
|
10
|
-
["<", ">"],
|
|
11
|
-
["(", ")"],
|
|
12
|
-
["[", "]"],
|
|
13
|
-
["{", "}"]
|
|
14
|
-
],
|
|
15
|
-
"autoClosingPairs": [
|
|
16
|
-
{
|
|
17
|
-
"open": "{%",
|
|
18
|
-
"close": "%}"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"open": "{{",
|
|
22
|
-
"close": "}}"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"open": "{#",
|
|
26
|
-
"close": "#}"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"open": "<",
|
|
30
|
-
"close": ">",
|
|
31
|
-
"notIn": ["string", "comment"]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"open": "\"",
|
|
35
|
-
"close": "\"",
|
|
36
|
-
"notIn": [
|
|
37
|
-
"string"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"open": "'",
|
|
42
|
-
"close": "'",
|
|
43
|
-
"notIn": [
|
|
44
|
-
"string",
|
|
45
|
-
"comment"
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"open": "(",
|
|
50
|
-
"close": ")"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"open": "[",
|
|
54
|
-
"close": "]"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"open": "{",
|
|
58
|
-
"close": "}"
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"surroundingPairs": [
|
|
62
|
-
{
|
|
63
|
-
"open": "{%",
|
|
64
|
-
"close": "%}"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"open": "{{",
|
|
68
|
-
"close": "}}"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"open": "{#",
|
|
72
|
-
"close": "#}"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"open": "<",
|
|
76
|
-
"close": ">"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"open": "\"",
|
|
80
|
-
"close": "\""
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"open": "'",
|
|
84
|
-
"close": "'"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"open": "(",
|
|
88
|
-
"close": ")"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"open": "[",
|
|
92
|
-
"close": "]"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"open": "{",
|
|
96
|
-
"close": "}"
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
"folding": {
|
|
100
|
-
"markers": {
|
|
101
|
-
"start": "{%\\s*(block|for|if|with|autoescape|spaceless|verbatim|comment|partialdef|cache|filter|blocktrans|regroup|language|addtoblock|style|script)\\b",
|
|
102
|
-
"end": "{%\\s*end(block|for|if|with|autoescape|spaceless|verbatim|comment|partialdef|endcache|endfilter|blocktrans|endblocktrans|endlanguage|endaddtoblock)|</(style|script)>"
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"wordPattern": "[a-zA-Z_][a-zA-Z0-9_.]*",
|
|
106
|
-
"indentationRules": {
|
|
107
|
-
"increaseIndentPattern": "{%\\s*(block|for|if|with|autoescape|spaceless|verbatim|comment|partialdef|cache|filter|blocktrans|regroup|language|addtoblock)\\b[^}]*%}|(<(?!(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)[^>]*>)[^>]*>)\\s*$",
|
|
108
|
-
"decreaseIndentPattern": "{%\\s*end(block|for|if|with|autoescape|spaceless|verbatim|comment|partialdef|endcache|endfilter|blocktrans|endblocktrans|endlanguage|endaddtoblock)\\b|</(html|head|body|div|section|article|aside|header|footer|nav|main|form|table|tr|td|th|tbody|thead|style|script)>"
|
|
109
|
-
},
|
|
110
|
-
"formatTabSize": 2,
|
|
111
|
-
"formatIndentSize": 2,
|
|
112
|
-
"formatOnSave": false,
|
|
113
|
-
"formatDefaultFormatter": "esbenp.prettier-vscode"
|
|
114
|
-
}
|
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
3
|
-
"name": "miki-template",
|
|
4
|
-
"scopeName": "text.html.miki",
|
|
5
|
-
"fileTypes": ["miki", "miki-template", "html", "django", "dj"],
|
|
6
|
-
"tokenColors": [
|
|
7
|
-
{
|
|
8
|
-
"name": "Template Tags",
|
|
9
|
-
"scope": ["entity.name.tag.django"],
|
|
10
|
-
"settings": {
|
|
11
|
-
"foreground": "#E8BF6A",
|
|
12
|
-
"fontStyle": "bold"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"name": "Template Variables (block.super)",
|
|
17
|
-
"scope": ["variable.other.django"],
|
|
18
|
-
"settings": {
|
|
19
|
-
"foreground": "#9CDCFE"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"name": "Template Filter Functions",
|
|
24
|
-
"scope": ["support.function.django"],
|
|
25
|
-
"settings": {
|
|
26
|
-
"foreground": "#4EC9B0"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "Template Strings",
|
|
31
|
-
"scope": ["string.quoted.double.django", "string.quoted.single.django"],
|
|
32
|
-
"settings": {
|
|
33
|
-
"foreground": "#CE9178"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": "Template Numbers",
|
|
38
|
-
"scope": ["constant.numeric.django"],
|
|
39
|
-
"settings": {
|
|
40
|
-
"foreground": "#B5CEA8"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"name": "Template Language Constants",
|
|
45
|
-
"scope": ["constant.language.django"],
|
|
46
|
-
"settings": {
|
|
47
|
-
"foreground": "#569CD6"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"name": "Template Operators",
|
|
52
|
-
"scope": ["keyword.operator.django"],
|
|
53
|
-
"settings": {
|
|
54
|
-
"foreground": "#D4D4D4",
|
|
55
|
-
"fontStyle": "bold"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"name": "Template Punctuation",
|
|
60
|
-
"scope": ["punctuation.separator.django", "punctuation.separator.key-value.django"],
|
|
61
|
-
"settings": {
|
|
62
|
-
"foreground": "#808080"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"name": "Template Comments",
|
|
67
|
-
"scope": ["comment.block.django"],
|
|
68
|
-
"settings": {
|
|
69
|
-
"foreground": "#6A9955",
|
|
70
|
-
"fontStyle": "italic"
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"name": "Template Filter Punctuation",
|
|
75
|
-
"scope": ["punctuation.separator.filter.django", "punctuation.separator.filter-argument.django"],
|
|
76
|
-
"settings": {
|
|
77
|
-
"foreground": "#C586C0"
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"name": "Prettier Ignore",
|
|
82
|
-
"scope": ["meta.prettier-ignore.django", "meta.prettier-ignore-region.django"],
|
|
83
|
-
"settings": {
|
|
84
|
-
"foreground": "#FFDD00",
|
|
85
|
-
"fontStyle": "italic"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"patterns": [
|
|
90
|
-
{
|
|
91
|
-
"include": "#comments"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"include": "#prettier-ignore"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"include": "#prettier-ignore-region"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"include": "#tag-block"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"include": "#variable-block"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"include": "#embedded-html"
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
"repository": {
|
|
110
|
-
"comments": {
|
|
111
|
-
"patterns": [
|
|
112
|
-
{
|
|
113
|
-
"name": "comment.block.django",
|
|
114
|
-
"begin": "\\{#",
|
|
115
|
-
"end": "#\\}",
|
|
116
|
-
"beginCaptures": {
|
|
117
|
-
"0": { "name": "punctuation.definition.comment.begin.django" }
|
|
118
|
-
},
|
|
119
|
-
"endCaptures": {
|
|
120
|
-
"0": { "name": "punctuation.definition.comment.end.django" }
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
},
|
|
125
|
-
"prettier-ignore": {
|
|
126
|
-
"name": "meta.prettier-ignore.django",
|
|
127
|
-
"match": "\\{#\\s*prettier-ignore\\s*#\\}",
|
|
128
|
-
"captures": {
|
|
129
|
-
"0": { "name": "comment.block.django" }
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"prettier-ignore-region": {
|
|
133
|
-
"name": "meta.prettier-ignore-region.django",
|
|
134
|
-
"begin": "\\{#\\s*prettier-ignore-start\\s*#\\}",
|
|
135
|
-
"end": "\\{#\\s*prettier-ignore-end\\s*#\\}",
|
|
136
|
-
"beginCaptures": {
|
|
137
|
-
"0": { "name": "punctuation.definition.comment.begin.django" }
|
|
138
|
-
},
|
|
139
|
-
"endCaptures": {
|
|
140
|
-
"0": { "name": "punctuation.definition.comment.end.django" }
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
"tag-block": {
|
|
144
|
-
"name": "meta.tag.django",
|
|
145
|
-
"begin": "(\\{%)(-?|\\s*)",
|
|
146
|
-
"end": "(-?\\s*%\\})",
|
|
147
|
-
"beginCaptures": {
|
|
148
|
-
"1": { "name": "punctuation.definition.tag.begin.django" }
|
|
149
|
-
},
|
|
150
|
-
"endCaptures": {
|
|
151
|
-
"1": { "name": "punctuation.definition.tag.end.django" }
|
|
152
|
-
},
|
|
153
|
-
"patterns": [
|
|
154
|
-
{
|
|
155
|
-
"name": "entity.name.tag.django",
|
|
156
|
-
"match": "(?i)\\b(if|elif|else|endif|for|empty|endfor|with|endwith|cycle|firstof|comment|endcomment|verbatim|endverbatim|include|extends|block|endblock|block.super|partialdef|endpartialdef|partial|load|splural|autoescape|autoescapeoff|endautoescape|filter|endfilter|spaceless|endspaceless|templatetag|endtemplatetag|trans|blocktrans|endblocktrans|language|endlanguage|plural|regroup|widthratio|debug|csrf_token|csp_nonce_attr|static|url|addtoblock|endaddtoblock)\\b"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"name": "variable.other.django",
|
|
160
|
-
"match": "[a-zA-Z_][a-zA-Z0-9_.]*"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"name": "string.quoted.double.django",
|
|
164
|
-
"match": "\"[^\"]*\""
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
"name": "string.quoted.single.django",
|
|
168
|
-
"match": "'[^']*'"
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
"name": "constant.numeric.django",
|
|
172
|
-
"match": "\\b\\d+\\.?\\d*\\b"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
"name": "constant.language.django",
|
|
176
|
-
"match": "\\b(true|false|null|undefined)\\b"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"name": "keyword.operator.django",
|
|
180
|
-
"match": "(?i)\\b(and|or|not|in|not in)\\b"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"name": "punctuation.separator.django",
|
|
184
|
-
"match": "="
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"name": "punctuation.separator.key-value.django",
|
|
188
|
-
"match": "\\b(as)\\b"
|
|
189
|
-
}
|
|
190
|
-
]
|
|
191
|
-
},
|
|
192
|
-
"variable-block": {
|
|
193
|
-
"name": "meta.variable.django",
|
|
194
|
-
"begin": "(\\{\\{)(-?|\\s*)",
|
|
195
|
-
"end": "(-?\\s*\\}\\})",
|
|
196
|
-
"beginCaptures": {
|
|
197
|
-
"1": { "name": "punctuation.definition.variable.begin.django" }
|
|
198
|
-
},
|
|
199
|
-
"endCaptures": {
|
|
200
|
-
"1": { "name": "punctuation.definition.variable.end.django" }
|
|
201
|
-
},
|
|
202
|
-
"patterns": [
|
|
203
|
-
{
|
|
204
|
-
"include": "#django-variables"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
"include": "#filters"
|
|
208
|
-
}
|
|
209
|
-
]
|
|
210
|
-
},
|
|
211
|
-
"django-variables": {
|
|
212
|
-
"patterns": [
|
|
213
|
-
{
|
|
214
|
-
"name": "variable.other.django",
|
|
215
|
-
"match": "[a-zA-Z_][a-zA-Z0-9_.]*"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
"name": "string.quoted.double.django",
|
|
219
|
-
"match": "\"[^\"]*\""
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"name": "string.quoted.single.django",
|
|
223
|
-
"match": "'[^']*'"
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
"name": "constant.numeric.django",
|
|
227
|
-
"match": "\\b\\d+\\.?\\d*\\b"
|
|
228
|
-
}
|
|
229
|
-
]
|
|
230
|
-
},
|
|
231
|
-
"filters": {
|
|
232
|
-
"name": "meta.filter.django",
|
|
233
|
-
"begin": "(\\|)",
|
|
234
|
-
"end": "(\\}\\}|\\|$)",
|
|
235
|
-
"beginCaptures": {
|
|
236
|
-
"1": { "name": "punctuation.separator.filter.django" }
|
|
237
|
-
},
|
|
238
|
-
"endCaptures": {
|
|
239
|
-
"1": { "name": "punctuation.separator.filter.django" }
|
|
240
|
-
},
|
|
241
|
-
"patterns": [
|
|
242
|
-
{
|
|
243
|
-
"name": "support.function.django",
|
|
244
|
-
"match": "(?i)\\b(upper|lower|title|capfirst|slugify|wordcount|striptags|truncatewords|truncatechars|truncatewords_html|truncatechars_html|linebreaks|linebreaksbr|cut|addslashes|removetags|safe|escape|escapejs|urlencode|escapeuri|urlize|stringformat|center|ljust|rjust|length|length_is|join|slice|first|last|dictsort|dictsortreversed|default|default_if_none|firstof|date|time|strftime|date_format|timesince|timeuntil|add|addtoblock|divisibleby|floatformat|yesno|pluralize|pluralize_either|filesizeformat|trans|regroup|intcomma|intword|apnumber|ordinal|naturalday|ordinal|lorem|get_digit|phone2numeric|pprint|make_list|unordered_list|json_script|json_script_filter|urt|datetime|field_class|strip|force_escape|linebreak_filter|truncatewords_filter|truncatechars_filter|safeseq|unordered_list|random|filesizeformat_pprint)\\b"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
"name": "punctuation.separator.filter-argument.django",
|
|
248
|
-
"begin": "(:)",
|
|
249
|
-
"end": "(?=\\||\\}\\})",
|
|
250
|
-
"beginCaptures": {
|
|
251
|
-
"1": { "name": "punctuation.separator.filter.argument.django" }
|
|
252
|
-
},
|
|
253
|
-
"patterns": [
|
|
254
|
-
{
|
|
255
|
-
"name": "string.quoted.double.django",
|
|
256
|
-
"match": "\"[^\"]*\""
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
"name": "string.quoted.single.django",
|
|
260
|
-
"match": "'[^']*'"
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
"name": "constant.numeric.django",
|
|
264
|
-
"match": "\\b\\d+\\.?\\d*\\b"
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
"name": "variable.other.django",
|
|
268
|
-
"match": "[a-zA-Z_][a-zA-Z0-9_.]*"
|
|
269
|
-
}
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
]
|
|
273
|
-
},
|
|
274
|
-
"embedded-html": {
|
|
275
|
-
"patterns": [
|
|
276
|
-
{
|
|
277
|
-
"name": "meta.tag.any.html",
|
|
278
|
-
"begin": "(<)(style)\\b(?=[^>]*>)",
|
|
279
|
-
"end": "(</)(style)(>)",
|
|
280
|
-
"beginCaptures": {
|
|
281
|
-
"1": { "name": "punctuation.definition.tag.begin.html" },
|
|
282
|
-
"2": { "name": "entity.name.tag.style.html" }
|
|
283
|
-
},
|
|
284
|
-
"endCaptures": {
|
|
285
|
-
"1": { "name": "punctuation.definition.tag.begin.html" },
|
|
286
|
-
"2": { "name": "entity.name.tag.style.html" },
|
|
287
|
-
"3": { "name": "punctuation.definition.tag.end.html" }
|
|
288
|
-
},
|
|
289
|
-
"patterns": [
|
|
290
|
-
{
|
|
291
|
-
"include": "source.css"
|
|
292
|
-
}
|
|
293
|
-
]
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
"name": "meta.tag.any.html",
|
|
297
|
-
"begin": "(<)(script)\\b(?=[^>]*>)",
|
|
298
|
-
"end": "(</)(script)(>)",
|
|
299
|
-
"beginCaptures": {
|
|
300
|
-
"1": { "name": "punctuation.definition.tag.begin.html" },
|
|
301
|
-
"2": { "name": "entity.name.tag.script.html" }
|
|
302
|
-
},
|
|
303
|
-
"endCaptures": {
|
|
304
|
-
"1": { "name": "punctuation.definition.tag.begin.html" },
|
|
305
|
-
"2": { "name": "entity.name.tag.script.html" },
|
|
306
|
-
"3": { "name": "punctuation.definition.tag.end.html" }
|
|
307
|
-
},
|
|
308
|
-
"patterns": [
|
|
309
|
-
{
|
|
310
|
-
"include": "source.js"
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
"name": "text.html.basic",
|
|
316
|
-
"begin": "(<)(?![\\?%])",
|
|
317
|
-
"end": "(>)",
|
|
318
|
-
"beginCaptures": {
|
|
319
|
-
"1": { "name": "punctuation.definition.tag.begin.html" }
|
|
320
|
-
},
|
|
321
|
-
"endCaptures": {
|
|
322
|
-
"1": { "name": "punctuation.definition.tag.end.html" }
|
|
323
|
-
},
|
|
324
|
-
"patterns": [
|
|
325
|
-
{
|
|
326
|
-
"name": "entity.name.tag.html",
|
|
327
|
-
"match": "\\/?([a-zA-Z][a-zA-Z0-9:-]*)\\/?"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
"name": "meta.attribute.html",
|
|
331
|
-
"begin": "\\b([a-zA-Z:-]+)(?=\\s*=)",
|
|
332
|
-
"beginCaptures": {
|
|
333
|
-
"1": { "name": "entity.other.attribute-name.html" }
|
|
334
|
-
},
|
|
335
|
-
"patterns": [
|
|
336
|
-
{
|
|
337
|
-
"name": "string.quoted.double.html",
|
|
338
|
-
"match": "\"([^\"]*)\""
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
"name": "string.quoted.single.html",
|
|
342
|
-
"match": "'([^']*)'"
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
"name": "string.unquoted.html",
|
|
346
|
-
"match": "[^\\s>]+"
|
|
347
|
-
}
|
|
348
|
-
]
|
|
349
|
-
}
|
|
350
|
-
]
|
|
351
|
-
}
|
|
352
|
-
]
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"grammarTests": [
|
|
3
|
-
{
|
|
4
|
-
"name": "Basic template structure",
|
|
5
|
-
"input": "{% extends \"base.html\" %}\n{% block content %}\n{{ title }}\n{% endblock %}",
|
|
6
|
-
"expectedTokens": [
|
|
7
|
-
{ "line": 0, "scope": "meta.tag.django" },
|
|
8
|
-
{ "line": 0, "scope": "entity.name.tag.django" },
|
|
9
|
-
{ "line": 1, "scope": "meta.tag.django" },
|
|
10
|
-
{ "line": 2, "scope": "meta.variable.django" },
|
|
11
|
-
{ "line": 2, "scope": "support.function.django" }
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"name": "If/else/endif tags",
|
|
16
|
-
"input": "{% if user.is_authenticated %}\n <p>Hello</p>\n{% else %}\n <p>Login</p>\n{% endif %}",
|
|
17
|
-
"expectedTags": ["if", "else", "endif"]
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"name": "For loop with empty",
|
|
21
|
-
"input": "{% for item in items %}\n {{ item }}\n{% empty %}\n No items\n{% endfor %}",
|
|
22
|
-
"expectedTags": ["for", "empty", "endfor"]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "Filter chain",
|
|
26
|
-
"input": "{{ name|lower|capfirst|truncatewords:10 }}",
|
|
27
|
-
"expectedFilters": ["lower", "capfirst", "truncatewords"]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "Comment block",
|
|
31
|
-
"input": "{# This is a comment #}",
|
|
32
|
-
"scope": "comment.block.django"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"name": "Prettier ignore",
|
|
36
|
-
"input": "{# prettier-ignore #}",
|
|
37
|
-
"scope": "meta.prettier-ignore.django"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "Include with context",
|
|
41
|
-
"input": "{% include \"partial.html\" with user=user %}",
|
|
42
|
-
"expectedTags": ["include"]
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"name": "Partialdef and partial",
|
|
46
|
-
"input": "{% partialdef card %}\n<div>{{ title }}</div>\n{% endpartialdef %}\n{% partial card %}",
|
|
47
|
-
"expectedTags": ["partialdef", "endpartialdef", "partial"]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"name": "i18n tags",
|
|
51
|
-
"input": "{% trans \"Hello\" %}\n{% blocktrans with name=user.name %}\n {{ name }}\n{% endblocktrans %}",
|
|
52
|
-
"expectedTags": ["trans", "blocktrans", "endblocktrans"]
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"name": "Operators",
|
|
56
|
-
"input": "{% if user.age >= 18 and user.is_verified or user.is_admin %}",
|
|
57
|
-
"expectedOperators": ["and", "or"]
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"name": "Cycle tag",
|
|
61
|
-
"input": "{% cycle 'odd' 'even' as marker silent %}",
|
|
62
|
-
"expectedTags": ["cycle"]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "Widthratio",
|
|
66
|
-
"input": "{% widthratio this_value max_value 100 %}",
|
|
67
|
-
"expectedTags": ["widthratio"]
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"name": "Cache tag",
|
|
71
|
-
"input": "{% cache 500 my_key %}\n{{ content }}\n{% endcache %}",
|
|
72
|
-
"expectedTags": ["cache", "endcache"]
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"name": "Spaceless",
|
|
76
|
-
"input": "{% spaceless %}\n <p> </p>\n{% endspaceless %}",
|
|
77
|
-
"expectedTags": ["spaceless", "endspaceless"]
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"name": "Autoescape",
|
|
81
|
-
"input": "{% autoescape off %}\n{{ html|safe }}\n{% endautoescape %}",
|
|
82
|
-
"expectedTags": ["autoescape", "endautoescape"]
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"name": "With block",
|
|
86
|
-
"input": "{% with user.profile as profile %}\n {{ profile.name }}\n{% endwith %}",
|
|
87
|
-
"expectedTags": ["with", "endwith"]
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"name": "Regroup",
|
|
91
|
-
"input": "{% regroup items by category as grouped %}\n{% for group in grouped %}\n {{ group.grouper }}\n{% endfor %}",
|
|
92
|
-
"expectedTags": ["regroup"]
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"name": "Block.super",
|
|
96
|
-
"input": "{% block content %}\n {{ block.super }}\n{% endblock %}",
|
|
97
|
-
"expectedTokens": [{ "scope": "variable.other.django" }]
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"name": "CSRF token",
|
|
101
|
-
"input": "{% csrf_token %}",
|
|
102
|
-
"expectedTags": ["csrf_token"]
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"name": "Static tag",
|
|
106
|
-
"input": "{% static \"css/style.css\" %}",
|
|
107
|
-
"expectedTags": ["static"]
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"name": "URL tag",
|
|
111
|
-
"input": "{% url \"home\" user.id %}",
|
|
112
|
-
"expectedTags": ["url"]
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"name": "Debug tag",
|
|
116
|
-
"input": "{% debug %}",
|
|
117
|
-
"expectedTags": ["debug"]
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"name": "Verbatim",
|
|
121
|
-
"input": "{% verbatim %}\n {{ not_a_variable }}\n {% not_a_tag %}\n{% endverbatim %}",
|
|
122
|
-
"expectedTags": ["verbatim", "endverbatim"]
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"name": "Filter block",
|
|
126
|
-
"input": "{% filter upper %}\n {{ name }}\n{% endfilter %}",
|
|
127
|
-
"expectedTags": ["filter", "endfilter"]
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"name": "Template tag symbol",
|
|
131
|
-
"input": "{% templatetag openblock %}",
|
|
132
|
-
"expectedTags": ["templatetag"]
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"name": "Addtoblock",
|
|
136
|
-
"input": "{% addtoblock css %}\n.selector { color: red; }\n{% endaddtoblock %}",
|
|
137
|
-
"expectedTags": ["addtoblock", "endaddtoblock"]
|
|
138
|
-
}
|
|
139
|
-
],
|
|
140
|
-
"validationTests": [
|
|
141
|
-
{
|
|
142
|
-
"name": "Unclosed if tag",
|
|
143
|
-
"input": "{% if condition %}\n content\n{% endfor %}",
|
|
144
|
-
"expectedErrors": ["Unclosed tag: {% if %}"]
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"name": "Mismatched tags",
|
|
148
|
-
"input": "{% if condition %}\n content\n{% endfor %}",
|
|
149
|
-
"expectedErrors": ["Mismatched tag: expected {% endif %} but found {% endfor %}"]
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"name": "Extends not first",
|
|
153
|
-
"input": "{% if true %}\n{% extends \"base.html\" %}\n{% endif %}",
|
|
154
|
-
"expectedErrors": ["{% extends %} must be the first tag"]
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"name": "Tag after extends",
|
|
158
|
-
"input": "{% extends \"base.html\" %}\n{% if true %}\n{% include \"other.html\" %}\n{% endif %}",
|
|
159
|
-
"expectedErrors": []
|
|
160
|
-
}
|
|
161
|
-
]
|
|
162
|
-
}
|