miki-template 1.2.0
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/.github/workflows/ci.yml +54 -0
- package/AGENT.md +71 -0
- package/API_REFERENCE.md +314 -0
- package/CHANGELOG.md +97 -0
- package/CODE_OF_CONDUCT.md +14 -0
- package/CONTRIBUTING.md +27 -0
- package/README.md +304 -0
- package/ROADMAP.md +40 -0
- package/benchmarks/report.json +17 -0
- package/benchmarks/run.js +49 -0
- package/benchmarks/templates/large.dtpl +7 -0
- package/benchmarks/templates/medium.dtpl +3 -0
- package/benchmarks/templates/small.dtpl +7 -0
- package/context/component.md +109 -0
- package/context/prd.md +131 -0
- package/context/project-structure.md +33 -0
- package/docs/README.md +18 -0
- package/docs/advanced_usage.md +71 -0
- package/docs/api.md +102 -0
- package/docs/filters.md +540 -0
- package/docs/installation.md +106 -0
- package/docs/overview.md +57 -0
- package/docs/partialdef.md +41 -0
- package/docs/security.md +27 -0
- package/docs/tags.md +610 -0
- package/docs/usage.md +599 -0
- package/eslint.config.mjs +34 -0
- package/miki-template-1.2.0.vsix +0 -0
- package/miki-template-extension/LICENSE +21 -0
- package/miki-template-extension/README.md +82 -0
- package/miki-template-extension/icon.png +0 -0
- package/miki-template-extension/icon.svg +10 -0
- package/miki-template-extension/package.json +46 -0
- package/miki-template-extension/snippets/miki-template.json +177 -0
- package/miki-template-extension/syntaxes/language-configuration.json +26 -0
- package/miki-template-extension/syntaxes/miki-template.tmLanguage.json +146 -0
- package/package.json +31 -0
- package/snippets/miki-template.json +177 -0
- package/src/asyncRender.js +21 -0
- package/src/cache.js +41 -0
- package/src/context.js +122 -0
- package/src/context_processors.js +41 -0
- package/src/esm.mjs +72 -0
- package/src/filters.js +527 -0
- package/src/i18n.js +171 -0
- package/src/index.js +454 -0
- package/src/lexer.js +92 -0
- package/src/libraries.js +240 -0
- package/src/parser.js +250 -0
- package/src/security.js +51 -0
- package/src/tags/control.js +591 -0
- package/src/tags/helpers.js +27 -0
- package/src/tags/i18n.js +230 -0
- package/src/tags/inheritance.js +216 -0
- package/src/tags/registry.js +18 -0
- package/src/tags/util.js +322 -0
- package/src/types.d.ts +107 -0
- package/syntaxes/language-configuration.json +26 -0
- package/syntaxes/miki-template.tmLanguage.json +146 -0
- package/tests/asyncRender.test.js +17 -0
- package/tests/base.html +6 -0
- package/tests/child.html +3 -0
- package/tests/context_processors.test.js +13 -0
- package/tests/esm.test.mjs +26 -0
- package/tests/filters.test.js +99 -0
- package/tests/include_security.test.js +9 -0
- package/tests/lexer.test.js +45 -0
- package/tests/parser.test.js +55 -0
- package/tests/partial.html +1 -0
- package/tests/partialdef.test.js +40 -0
- package/tests/production_checks.js +57 -0
- package/tests/security.test.js +28 -0
- package/tests/tags.test.js +203 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# miki-template VS Code Extension
|
|
2
|
+
|
|
3
|
+
Syntax highlighting, bracket matching, and snippets for [miki-template](https://github.com/alainmiki/miki-template) — a Django-style template engine for Node.js and Express.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Syntax highlighting for `.miki` and `.miki-template` files
|
|
8
|
+
- Snippets for all built-in tags and common patterns
|
|
9
|
+
- Bracket auto-closing for `{% %}`, `{{ }}`, `{# #}`
|
|
10
|
+
- Comment toggling with `{# #}`
|
|
11
|
+
|
|
12
|
+
## Supported Tags
|
|
13
|
+
|
|
14
|
+
`if / elif / else / endif`, `for / empty / endfor`, `with / endwith`, `cycle`, `comment / endcomment`, `verbatim / endverbatim`, `include`, `extends`, `block / endblock`, `partialdef / endpartialdef`, `partial`, `load`, `templatetag`, `trans`, `blocktrans`, `language / endlanguage`, `widthratio`, `debug`, `autoescape / endautoescape`, `filter / endfilter`, `plural`, `cache / endcache`, `markdown / endmarkdown`, `regroup`, `firstof`, `csrf_token`, `csp_nonce_attr`, `static`, `url`
|
|
15
|
+
|
|
16
|
+
## Supported Filters
|
|
17
|
+
|
|
18
|
+
`upper`, `lower`, `title`, `capfirst`, `slugify`, `wordcount`, `striptags`, `linebreaks`, `linebreaksbr`, `truncatewords`, `truncatechars`, `safe`, `escape`, `escapejs`, `length`, `length_is`, `join`, `slice`, `dictsort`, `dictsortreversed`, `first`, `last`, `default`, `default_if_none`, `firstof`, `date`, `time`, `strftime`, `timesince`, `timeuntil`, `add`, `divisibleby`, `floatformat`, `yesno`, `pluralize`, `filesizeformat`, `urlencode`, `escapeuri`, `stringformat`, `cut`, `addslashes`, `removetags`, `trans`, `regroup`, `intcomma`, `intword`, `apnumber`, `ordinal`, `naturalday`, `lorem`
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### From VS Code Marketplace
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
code --install-extension miki-template
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or search for **miki-template** in the Extensions view (`Ctrl+Shift+X`).
|
|
29
|
+
|
|
30
|
+
### Manual installation
|
|
31
|
+
|
|
32
|
+
1. Copy `syntaxes/` and `snippets/` into your project or user settings
|
|
33
|
+
2. Associate `.miki` files with `miki-template`
|
|
34
|
+
|
|
35
|
+
## File Associations
|
|
36
|
+
|
|
37
|
+
Add to your workspace or user `settings.json`:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"files.associations": {
|
|
42
|
+
"*.miki": "miki-template",
|
|
43
|
+
"*.miki-template": "miki-template"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Snippets
|
|
49
|
+
|
|
50
|
+
Type any of the following prefixes and press `Tab`:
|
|
51
|
+
|
|
52
|
+
| Prefix | Output |
|
|
53
|
+
|--------|--------|
|
|
54
|
+
| `if` | `{% if %}...{% endif %}` |
|
|
55
|
+
| `ifelse` | `{% if %}...{% else %}...{% endif %}` |
|
|
56
|
+
| `for` | `{% for %}` with `empty` |
|
|
57
|
+
| `block` | `{% block %}` |
|
|
58
|
+
| `extends` | `{% extends %}` |
|
|
59
|
+
| `include` | `{% include %}` |
|
|
60
|
+
| `with` | `{% with %}` |
|
|
61
|
+
| `cycle` | `{% cycle %}` |
|
|
62
|
+
| `trans` | `{% trans %}` |
|
|
63
|
+
| `blocktrans` | `{% blocktrans %}` |
|
|
64
|
+
| `language` | `{% language %}` |
|
|
65
|
+
| `partialdef` | `{% partialdef %}` |
|
|
66
|
+
| `partial` | `{% partial %}` |
|
|
67
|
+
| `csrf` | `{% csrf_token %}` |
|
|
68
|
+
| `csp` | `{% csp_nonce_attr %}` |
|
|
69
|
+
| `static` | `{% static %}` |
|
|
70
|
+
| `url` | `{% url %}` |
|
|
71
|
+
| `widthratio` | `{% widthratio %}` |
|
|
72
|
+
| `debug` | `{% debug %}` |
|
|
73
|
+
| `load` | `{% load %}` |
|
|
74
|
+
| `comment` | `{# #}` block comment |
|
|
75
|
+
| `verbatim` | `{% verbatim %}` |
|
|
76
|
+
| `regroup` | `{% for %}` with `regroup` filter |
|
|
77
|
+
| `firstof` | `{% firstof %}` |
|
|
78
|
+
| `filter` | `{% filter %}` block |
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128">
|
|
3
|
+
<rect width="128" height="128" rx="16" fill="#0c4a6e"/>
|
|
4
|
+
<path d="M24 28h56v8H24zM24 52h56v8H24zM24 76h40v8H24z" fill="#fff" opacity="0.9"/>
|
|
5
|
+
<path d="M24 100h24v8H24z" fill="#7dd3fc"/>
|
|
6
|
+
<text x="92" y="36" font-family="monospace" font-size="11" fill="#7dd3fc">%}</text>
|
|
7
|
+
<text x="92" y="60" font-family="monospace" font-size="11" fill="#7dd3fc">%}</text>
|
|
8
|
+
<text x="92" y="84" font-family="monospace" font-size="11" fill="#7dd3fc">%}</text>
|
|
9
|
+
<text x="40" y="108" font-family="monospace" font-size="11" fill="#0c4a6e">{%</text>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "miki-template",
|
|
3
|
+
"displayName": "miki-template",
|
|
4
|
+
"description": "Django-style template language syntax highlighting and snippets for miki-template",
|
|
5
|
+
"version": "1.2.0",
|
|
6
|
+
"engines": {
|
|
7
|
+
"vscode": "^1.0.0"
|
|
8
|
+
},
|
|
9
|
+
"categories": [
|
|
10
|
+
"Programming Languages",
|
|
11
|
+
"Snippets"
|
|
12
|
+
],
|
|
13
|
+
"contributes": {
|
|
14
|
+
"languages": [
|
|
15
|
+
{
|
|
16
|
+
"id": "miki-template",
|
|
17
|
+
"aliases": ["miki-template", "miki", "django-template"],
|
|
18
|
+
"extensions": [".miki", ".miki-template"],
|
|
19
|
+
"configuration": "./language-configuration.json"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"grammars": [
|
|
23
|
+
{
|
|
24
|
+
"language": "miki-template",
|
|
25
|
+
"scopeName": "text.html.miki",
|
|
26
|
+
"path": "./syntaxes/miki-template.tmLanguage.json",
|
|
27
|
+
"tokenTypes": {
|
|
28
|
+
"text": "text.html.miki"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"snippets": [
|
|
33
|
+
{
|
|
34
|
+
"language": "miki-template",
|
|
35
|
+
"path": "./snippets/miki-template.json"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"publisher": "alainmiki",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/alainmiki/miki-template.git"
|
|
43
|
+
},
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"icon": "icon.png"
|
|
46
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
{
|
|
2
|
+
"miki-template": {
|
|
3
|
+
"if": {
|
|
4
|
+
"prefix": "if",
|
|
5
|
+
"body": [
|
|
6
|
+
"{% if ${1:condition} %}",
|
|
7
|
+
" ${2:content}",
|
|
8
|
+
"{% endif %}"
|
|
9
|
+
],
|
|
10
|
+
"description": "If block"
|
|
11
|
+
},
|
|
12
|
+
"ifelse": {
|
|
13
|
+
"prefix": "ifelse",
|
|
14
|
+
"body": [
|
|
15
|
+
"{% if ${1:condition} %}",
|
|
16
|
+
" ${2:content}",
|
|
17
|
+
"{% else %}",
|
|
18
|
+
" ${3:fallback}",
|
|
19
|
+
"{% endif %}"
|
|
20
|
+
],
|
|
21
|
+
"description": "If/else block"
|
|
22
|
+
},
|
|
23
|
+
"for": {
|
|
24
|
+
"prefix": "for",
|
|
25
|
+
"body": [
|
|
26
|
+
"{% for ${1:item} in ${2:items} %}",
|
|
27
|
+
" ${3:{{ ${1} }}}",
|
|
28
|
+
"{% empty %}",
|
|
29
|
+
" ${4:No items}",
|
|
30
|
+
"{% endfor %}"
|
|
31
|
+
],
|
|
32
|
+
"description": "For loop"
|
|
33
|
+
},
|
|
34
|
+
"block": {
|
|
35
|
+
"prefix": "block",
|
|
36
|
+
"body": [
|
|
37
|
+
"{% block ${1:name} %}",
|
|
38
|
+
" ${2:content}",
|
|
39
|
+
"{% endblock %}"
|
|
40
|
+
],
|
|
41
|
+
"description": "Block definition"
|
|
42
|
+
},
|
|
43
|
+
"extends": {
|
|
44
|
+
"prefix": "extends",
|
|
45
|
+
"body": "{% extends \"${1:base.html}\" %}",
|
|
46
|
+
"description": "Extends parent template"
|
|
47
|
+
},
|
|
48
|
+
"include": {
|
|
49
|
+
"prefix": "include",
|
|
50
|
+
"body": "{% include \"${1:header.html}\" %}",
|
|
51
|
+
"description": "Include template"
|
|
52
|
+
},
|
|
53
|
+
"with": {
|
|
54
|
+
"prefix": "with",
|
|
55
|
+
"body": [
|
|
56
|
+
"{% with ${1:var} as ${2:alias} %}",
|
|
57
|
+
" ${3:{{ ${2} }}}",
|
|
58
|
+
"{% endwith %}"
|
|
59
|
+
],
|
|
60
|
+
"description": "With block"
|
|
61
|
+
},
|
|
62
|
+
"cycle": {
|
|
63
|
+
"prefix": "cycle",
|
|
64
|
+
"body": "{% cycle '${1:odd}' '${2:even}' %}",
|
|
65
|
+
"description": "Cycle tag"
|
|
66
|
+
},
|
|
67
|
+
"trans": {
|
|
68
|
+
"prefix": "trans",
|
|
69
|
+
"body": "{% trans \"${1:Hello, World!}\" %}",
|
|
70
|
+
"description": "Translate string"
|
|
71
|
+
},
|
|
72
|
+
"blocktrans": {
|
|
73
|
+
"prefix": "blocktrans",
|
|
74
|
+
"body": [
|
|
75
|
+
"{% blocktrans with ${1:name}=${2:user.name} %}",
|
|
76
|
+
" ${3:Hello {{ ${1} }}}",
|
|
77
|
+
"{% endblocktrans %}"
|
|
78
|
+
],
|
|
79
|
+
"description": "Translate block"
|
|
80
|
+
},
|
|
81
|
+
"language": {
|
|
82
|
+
"prefix": "language",
|
|
83
|
+
"body": [
|
|
84
|
+
"{% language \"${1:fr}\" %}",
|
|
85
|
+
" ${2}",
|
|
86
|
+
"{% endlanguage %}"
|
|
87
|
+
],
|
|
88
|
+
"description": "Switch language"
|
|
89
|
+
},
|
|
90
|
+
"partialdef": {
|
|
91
|
+
"prefix": "partialdef",
|
|
92
|
+
"body": [
|
|
93
|
+
"{% partialdef ${1:name} %}",
|
|
94
|
+
" ${2}",
|
|
95
|
+
"{% endpartialdef %}"
|
|
96
|
+
],
|
|
97
|
+
"description": "Define partial"
|
|
98
|
+
},
|
|
99
|
+
"partial": {
|
|
100
|
+
"prefix": "partial",
|
|
101
|
+
"body": "{% partial ${1:name} %}",
|
|
102
|
+
"description": "Render partial"
|
|
103
|
+
},
|
|
104
|
+
"csrf": {
|
|
105
|
+
"prefix": "csrf",
|
|
106
|
+
"body": "{% csrf_token %}",
|
|
107
|
+
"description": "CSRF token input"
|
|
108
|
+
},
|
|
109
|
+
"csp": {
|
|
110
|
+
"prefix": "csp",
|
|
111
|
+
"body": "<script {% csp_nonce_attr %}></script>",
|
|
112
|
+
"description": "CSP nonce attribute"
|
|
113
|
+
},
|
|
114
|
+
"static": {
|
|
115
|
+
"prefix": "static",
|
|
116
|
+
"body": "{% static \"${1:css/app.css}\" %}",
|
|
117
|
+
"description": "Static file URL"
|
|
118
|
+
},
|
|
119
|
+
"url": {
|
|
120
|
+
"prefix": "url",
|
|
121
|
+
"body": "{% url \"${1:route_name}\" ${2:args} %}",
|
|
122
|
+
"description": "URL for named route"
|
|
123
|
+
},
|
|
124
|
+
"widthratio": {
|
|
125
|
+
"prefix": "widthratio",
|
|
126
|
+
"body": "{% widthratio ${1:value} ${2:max} ${3:max_width} %}",
|
|
127
|
+
"description": "Proportional width"
|
|
128
|
+
},
|
|
129
|
+
"debug": {
|
|
130
|
+
"prefix": "debug",
|
|
131
|
+
"body": "{% debug %}",
|
|
132
|
+
"description": "Dump template context"
|
|
133
|
+
},
|
|
134
|
+
"load": {
|
|
135
|
+
"prefix": "load",
|
|
136
|
+
"body": "{% load ${1:i18n} %}",
|
|
137
|
+
"description": "Load tag library"
|
|
138
|
+
},
|
|
139
|
+
"comment": {
|
|
140
|
+
"prefix": "comment",
|
|
141
|
+
"body": [
|
|
142
|
+
"{#",
|
|
143
|
+
" ${1:comment}",
|
|
144
|
+
"#}"
|
|
145
|
+
],
|
|
146
|
+
"description": "Comment block"
|
|
147
|
+
},
|
|
148
|
+
"verbatim": {
|
|
149
|
+
"prefix": "verbatim",
|
|
150
|
+
"body": [
|
|
151
|
+
"{% verbatim %}",
|
|
152
|
+
" ${1}",
|
|
153
|
+
"{% endverbatim %}"
|
|
154
|
+
],
|
|
155
|
+
"description": "Verbatim block"
|
|
156
|
+
},
|
|
157
|
+
"regroup": {
|
|
158
|
+
"prefix": "regroup",
|
|
159
|
+
"body": "{% for ${1:group} in ${2:items}|regroup:\"${3:category}\" %}{{ ${1}.grouper }}{% endfor %}",
|
|
160
|
+
"description": "Regroup by attribute"
|
|
161
|
+
},
|
|
162
|
+
"firstof": {
|
|
163
|
+
"prefix": "firstof",
|
|
164
|
+
"body": "{% firstof ${1:var1} ${2:var2} \"${3:fallback}\" %}",
|
|
165
|
+
"description": "First truthy value"
|
|
166
|
+
},
|
|
167
|
+
"filter_block": {
|
|
168
|
+
"prefix": "filter",
|
|
169
|
+
"body": [
|
|
170
|
+
"{% filter ${1:lower} %}",
|
|
171
|
+
" ${2}",
|
|
172
|
+
"{% endfilter %}"
|
|
173
|
+
],
|
|
174
|
+
"description": "Filter block"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"comments": {
|
|
3
|
+
"lineComment": "{#",
|
|
4
|
+
"blockComment": ["{#", "#}"]
|
|
5
|
+
},
|
|
6
|
+
"brackets": [
|
|
7
|
+
["{", "}"],
|
|
8
|
+
["[", "]"],
|
|
9
|
+
["(", ")"]
|
|
10
|
+
],
|
|
11
|
+
"autoClosingPairs": [
|
|
12
|
+
{ "open": "{", "close": "}" },
|
|
13
|
+
{ "open": "[", "close": "]" },
|
|
14
|
+
{ "open": "(", "close": ")" },
|
|
15
|
+
{ "open": "\"", "close": "\"", "notIn": ["string"] },
|
|
16
|
+
{ "open": "'", "close": "'", "notIn": ["string", "comment"] }
|
|
17
|
+
],
|
|
18
|
+
"surroundingPairs": [
|
|
19
|
+
{ "open": "{", "close": "}" },
|
|
20
|
+
{ "open": "[", "close": "]" },
|
|
21
|
+
{ "open": "(", "close": ")" },
|
|
22
|
+
{ "open": "\"", "close": "\"" },
|
|
23
|
+
{ "open": "'", "close": "'" }
|
|
24
|
+
],
|
|
25
|
+
"wordPattern": "[a-zA-Z_][a-zA-Z0-9_.]*"
|
|
26
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scopeName": "text.html.miki",
|
|
3
|
+
"name": "miki-template",
|
|
4
|
+
"patterns": [
|
|
5
|
+
{
|
|
6
|
+
"include": "#comment"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"include": "#tag"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"include": "#variable"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"include": "#string"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"comment": {
|
|
20
|
+
"name": "comment.block.miki",
|
|
21
|
+
"begin": "\\{#",
|
|
22
|
+
"end": "#\\}",
|
|
23
|
+
"beginCaptures": {
|
|
24
|
+
"0": { "name": "punctuation.definition.comment.begin.miki" }
|
|
25
|
+
},
|
|
26
|
+
"endCaptures": {
|
|
27
|
+
"0": { "name": "punctuation.definition.comment.end.miki" }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"tag": {
|
|
31
|
+
"name": "meta.tag.miki",
|
|
32
|
+
"begin": "\\{%",
|
|
33
|
+
"end": "%\\}",
|
|
34
|
+
"beginCaptures": {
|
|
35
|
+
"0": { "name": "punctuation.definition.tag.begin.miki" }
|
|
36
|
+
},
|
|
37
|
+
"endCaptures": {
|
|
38
|
+
"0": { "name": "punctuation.definition.tag.end.miki" }
|
|
39
|
+
},
|
|
40
|
+
"patterns": [
|
|
41
|
+
{
|
|
42
|
+
"name": "entity.name.tag.miki",
|
|
43
|
+
"match": "(?i)\\b(if|elif|else|endif|for|empty|endfor|with|endwith|cycle|comment|endcomment|verbatim|endverbatim|include|extends|block|endblock|partialdef|endpartialdef|partial|load|templatetag|trans|blocktrans|language|endlanguage|plural|widthratio|debug|endif|endfor|endwith|endblock|endcomment|endverbatim|endpartialdef|endblocktrans|endlanguage|endcache|endmarkdown)\\b"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "string.quoted.double.miki",
|
|
47
|
+
"match": "\"[^\"]*\""
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "string.quoted.single.miki",
|
|
51
|
+
"match": "'[^']*'"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "constant.numeric.miki",
|
|
55
|
+
"match": "\\b\\d+\\b"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "keyword.operator.miki",
|
|
59
|
+
"match": "(?i)\\b(and|or|not|in|not in)\\b"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "punctuation.separator.miki",
|
|
63
|
+
"match": "="
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"variable": {
|
|
68
|
+
"name": "variable.other.miki",
|
|
69
|
+
"begin": "\\{\\{",
|
|
70
|
+
"end": "\\}\\}",
|
|
71
|
+
"beginCaptures": {
|
|
72
|
+
"0": { "name": "punctuation.definition.variable.begin.miki" }
|
|
73
|
+
},
|
|
74
|
+
"endCaptures": {
|
|
75
|
+
"0": { "name": "punctuation.definition.variable.end.miki" }
|
|
76
|
+
},
|
|
77
|
+
"patterns": [
|
|
78
|
+
{
|
|
79
|
+
"name": "variable.other.miki",
|
|
80
|
+
"match": "[a-zA-Z_][a-zA-Z0-9_.]*"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"include": "#filter"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "string.quoted.double.miki",
|
|
87
|
+
"match": "\"[^\"]*\""
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "string.quoted.single.miki",
|
|
91
|
+
"match": "'[^']*'"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"filter": {
|
|
96
|
+
"name": "meta.filter.miki",
|
|
97
|
+
"begin": "\\|",
|
|
98
|
+
"end": "(?=\\}|$)",
|
|
99
|
+
"beginCaptures": {
|
|
100
|
+
"0": { "name": "punctuation.separator.filter.miki" }
|
|
101
|
+
},
|
|
102
|
+
"patterns": [
|
|
103
|
+
{
|
|
104
|
+
"name": "support.function.miki",
|
|
105
|
+
"match": "[a-zA-Z_][a-zA-Z0-9_]*"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"begin": ":",
|
|
109
|
+
"beginCaptures": {
|
|
110
|
+
"0": { "name": "punctuation.separator.filter.argument.miki" }
|
|
111
|
+
},
|
|
112
|
+
"end": "(?=\\||\\}\\})",
|
|
113
|
+
"patterns": [
|
|
114
|
+
{
|
|
115
|
+
"name": "string.quoted.double.miki",
|
|
116
|
+
"match": "\"[^\"]*\""
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "string.quoted.single.miki",
|
|
120
|
+
"match": "'[^']*'"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "constant.numeric.miki",
|
|
124
|
+
"match": "\\b\\d+\\b"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "variable.other.miki",
|
|
128
|
+
"match": "[a-zA-Z_][a-zA-Z0-9_.]*"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"string": {
|
|
135
|
+
"name": "string.quoted.double.miki",
|
|
136
|
+
"begin": "\"",
|
|
137
|
+
"end": "\"",
|
|
138
|
+
"beginCaptures": {
|
|
139
|
+
"0": { "name": "punctuation.definition.string.begin.miki" }
|
|
140
|
+
},
|
|
141
|
+
"endCaptures": {
|
|
142
|
+
"0": { "name": "punctuation.definition.string.end.miki" }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "miki-template",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Django-Style template engine for Node.js and Express",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./src/esm.mjs",
|
|
9
|
+
"require": "./src/index.js",
|
|
10
|
+
"default": "./src/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "node -e \"const fs=require('fs');const path=require('path');const files=fs.readdirSync('tests').filter(f=>f.endsWith('.test.js')||f.endsWith('.test.mjs')).map(f=>path.join('tests',f));require('child_process').execSync('node --test '+files.join(' '),{stdio:'inherit'})\"",
|
|
15
|
+
"bench": "node benchmarks/run.js"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"django",
|
|
19
|
+
"template",
|
|
20
|
+
"engine",
|
|
21
|
+
"express",
|
|
22
|
+
"nodejs",
|
|
23
|
+
"esm"
|
|
24
|
+
],
|
|
25
|
+
"author": "",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"he": "^1.2.0",
|
|
29
|
+
"date-fns": "^3.6.0"
|
|
30
|
+
}
|
|
31
|
+
}
|