Skip to content

Commit 47e79f1

Browse files
Обновил зависимости vitepress и shikijs до версии 1.3.3 и 1.29.2 соответственно. Добавил синтаксисы для Fenom и MODX.
1 parent 479e6e1 commit 47e79f1

File tree

5 files changed

+418
-53
lines changed

5 files changed

+418
-53
lines changed
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "Fenom",
4+
"scopeName": "text.html.fenom",
5+
"fileTypes": ["tpl"],
6+
"injections": {
7+
"L:text.html.fenom -meta.embedded.literal -comment.block.fenom": {
8+
"patterns": [
9+
{
10+
"include": "#nonFenom"
11+
},
12+
{
13+
"include": "#comments"
14+
},
15+
{
16+
"include": "#blocks"
17+
},
18+
{ "include": "#lineComments" }
19+
]
20+
}
21+
},
22+
"patterns": [
23+
{ "include": "text.html.derivative" },
24+
{ "include": "#lineComments" }
25+
],
26+
"repository": {
27+
"nonFenom": {
28+
"patterns": [
29+
{
30+
"match": "(\\{%)\\s",
31+
"name": "invalid.illegal.non-fenom.fenom"
32+
}
33+
]
34+
},
35+
"comments": {
36+
"begin": "{{?\\*",
37+
"beginCaptures": {
38+
"0": { "name": "punctuation.definition.comment.begin.fenom" }
39+
},
40+
"name": "comment.block.fenom",
41+
"end": "\\*}}?",
42+
"endCaptures": {
43+
"0": { "name": "punctuation.definition.comment.end.fenom" }
44+
},
45+
"patterns": [
46+
{
47+
"match": "{{?\\*",
48+
"name": "invalid.illegal.characters-not-allowed-here.fenom"
49+
}
50+
]
51+
},
52+
"blocks": {
53+
"patterns": [
54+
{
55+
"begin": "(\\{%?)",
56+
"beginCaptures": {
57+
"1": {
58+
"name": "punctuation.section.embedded.begin.fenom"
59+
}
60+
},
61+
"end": "(%?\\})",
62+
"endCaptures": {
63+
"1": {
64+
"name": "punctuation.section.embedded.end.fenom"
65+
}
66+
},
67+
"name": "source.fenom",
68+
"patterns": [
69+
{
70+
"include": "#strings"
71+
},
72+
{
73+
"include": "#variables"
74+
},
75+
{
76+
"include": "#lang"
77+
}
78+
]
79+
}
80+
]
81+
},
82+
"lang": {
83+
"patterns": [
84+
{
85+
"match": "(\\|=|\\+=|-=|\\*=|\\%=|!==|=|&=|\\^=|~|/=|\\-|\\+|/|\\*|@|!=|!|<=|>=|<|>|===|==|%|&&|\\|\\|)|\\b(and|or|xor)\\b",
86+
"name": "keyword.operator.fenom"
87+
},
88+
{
89+
"match": "\\b(TRUE|FALSE|true|false)\\b",
90+
"name": "constant.language.fenom"
91+
},
92+
{
93+
"match": "\\b(var|set|add|if|else|elseif|foreach|foreachelse|autoescape|autotrim|for|extends|block|use|paste|parent|filter|break|continue|forelse|ignore|include|insert|macro|import|raw|switch|case|unset)\\b",
94+
"name": "keyword.control.fenom"
95+
},
96+
{
97+
"captures": {
98+
"0": {
99+
"name": "variable.parameter.fenom"
100+
}
101+
},
102+
"match": "\\b([a-zA-Z]+)=",
103+
"name": "meta.attribute.fenom"
104+
},
105+
{
106+
"match": "\\b(plus|from|as|capture|default|cycle)\\b",
107+
"name": "support.function.built-in.fenom"
108+
},
109+
{
110+
"captures": {
111+
"0": {
112+
"name": "entity.name.function.fenom"
113+
}
114+
},
115+
"match": "\\|\\s*([a-zA-Z_]+)\\b"
116+
}
117+
]
118+
},
119+
"strings": {
120+
"patterns": [
121+
{
122+
"begin": "'",
123+
"beginCaptures": {
124+
"0": {
125+
"name": "punctuation.definition.string.begin.fenom"
126+
}
127+
},
128+
"end": "'",
129+
"endCaptures": {
130+
"0": {
131+
"name": "punctuation.definition.string.end.fenom"
132+
}
133+
},
134+
"name": "string.quoted.single.fenom",
135+
"patterns": [
136+
{
137+
"match": "\\\\.",
138+
"name": "constant.character.escape.fenom"
139+
}
140+
]
141+
},
142+
{
143+
"begin": "\"",
144+
"beginCaptures": {
145+
"0": {
146+
"name": "punctuation.definition.string.begin.fenom"
147+
}
148+
},
149+
"end": "\"",
150+
"endCaptures": {
151+
"0": {
152+
"name": "punctuation.definition.string.end.fenom"
153+
}
154+
},
155+
"name": "string.quoted.double.fenom",
156+
"patterns": [
157+
{
158+
"match": "\\\\.",
159+
"name": "constant.character.escape.fenom"
160+
}
161+
]
162+
}
163+
]
164+
},
165+
"variables": {
166+
"patterns": [
167+
{
168+
"match": "\\$_modx\\b",
169+
"name": "support.variable.fenom"
170+
},
171+
{
172+
"captures": {
173+
"1": {
174+
"name": "variable.language.fenom"
175+
}
176+
},
177+
"match": "(\\$)\\.\\b",
178+
"name": "variable.other.global.fenom"
179+
},
180+
{
181+
"captures": {
182+
"1": {
183+
"name": "punctuation.definition.variable.fenom"
184+
},
185+
"2": {
186+
"name": "variable.other.fenom"
187+
}
188+
},
189+
"match": "(\\$)([a-zA-Z_][a-zA-Z0-9_]*)\\b",
190+
"name": "variable.other.fenom"
191+
},
192+
{
193+
"captures": {
194+
"1": {
195+
"name": "punctuation.definition.variable.fenom"
196+
},
197+
"2": {
198+
"name": "variable.other.fenom"
199+
}
200+
},
201+
"match": "(\\$\\.)([a-zA-Z_.][a-zA-Z0-9_.]*)\\b",
202+
"name": "variable.other.fenom"
203+
},
204+
{
205+
"captures": {
206+
"1": {
207+
"name": "keyword.operator.fenom"
208+
},
209+
"2": {
210+
"name": "variable.other.property.fenom"
211+
}
212+
},
213+
"match": "(->)([a-zA-Z_][a-zA-Z0-9_]*)\\b",
214+
"name": "variable.other.fenom"
215+
},
216+
{
217+
"captures": {
218+
"1": {
219+
"name": "keyword.operator.fenom"
220+
},
221+
"2": {
222+
"name": "meta.function-call.object.fenom"
223+
},
224+
"3": {
225+
"name": "punctuation.definition.variable.fenom"
226+
},
227+
"4": {
228+
"name": "punctuation.definition.variable.fenom"
229+
}
230+
},
231+
"match": "(->)([a-zA-Z_][a-zA-Z0-9_]*)(\\().*?(\\))",
232+
"name": "variable.other.fenom"
233+
}
234+
]
235+
},
236+
"lineComments": {
237+
"patterns": [
238+
{
239+
"match": "//.*$",
240+
"name": "comment.line.double-slash.fenom"
241+
}
242+
]
243+
}
244+
}
245+
}

.vitepress/theme/syntaxes/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { createRequire } from 'module'
33

44
const require = createRequire(import.meta.url)
55

6-
const modx = require('modx-tmlanguage')
7-
const fenomGrammar = require('fenom-tmlanguage')
6+
const modx = require('./modx.tmLanguage.json')
7+
const fenomGrammar = require('./fenom.tmLanguage.json')
88
const smartyGrammar = require('@modix/smarty-tmlanguage/smarty.tmLanguage.json')
99

1010
const fenom = {

0 commit comments

Comments
 (0)