Skip to content

Commit 69e78bf

Browse files
deathaxeskyronic
authored andcommitted
Prepare for future changes of ST's HTML.sublime-syntax
ST's HTML.sublime-syntax may change in the future so that the change of this commit is required to maintain compatibility. It is planned to highlight certain self-closing tags illegal, if they are known not to support it. This change is backward compatible with older builds of ST4.
1 parent c39dc1b commit 69e78bf

File tree

2 files changed

+53
-37
lines changed

2 files changed

+53
-37
lines changed

Vue Component.sublime-syntax

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,11 @@ contexts:
134134
- match: (?i)(?=coffee{{unquoted_attribute_break}}|\'coffee\'|"coffee")
135135
set:
136136
- - meta_scope: meta.tag.script.begin.html
137-
- include: script-common
138137
- match: '>'
139138
scope: punctuation.definition.tag.end.html
140139
set:
141-
- embed_scope: source.coffee.embedded.html
142-
match: '{{script_content_begin}}'
140+
- match: '{{script_content_begin}}'
141+
embed_scope: source.coffee.embedded.html
143142
escape_captures:
144143
1: source.coffee.embedded.html
145144
2: comment.block.html punctuation.definition.comment.end.html
@@ -150,17 +149,17 @@ contexts:
150149
pop: 1
151150
embed: scope:source.coffee
152151
escape: '{{script_content_end}}'
152+
- include: script-common
153153
- tag-generic-attribute-meta
154154
- tag-generic-attribute-value
155155
- match: (?i)(?=livescript{{unquoted_attribute_break}}|\'livescript\'|"livescript")
156156
set:
157157
- - meta_scope: meta.tag.script.begin.html
158-
- include: script-common
159158
- match: '>'
160159
scope: punctuation.definition.tag.end.html
161160
set:
162-
- embed_scope: source.livescript.embedded.html
163-
match: '{{script_content_begin}}'
161+
- match: '{{script_content_begin}}'
162+
embed_scope: source.livescript.embedded.html
164163
escape_captures:
165164
1: source.livescript.embedded.html
166165
2: comment.block.html punctuation.definition.comment.end.html
@@ -171,17 +170,17 @@ contexts:
171170
pop: 1
172171
embed: scope:source.livescript
173172
escape: '{{script_content_end}}'
173+
- include: script-common
174174
- tag-generic-attribute-meta
175175
- tag-generic-attribute-value
176176
- match: (?i)(?=ts{{unquoted_attribute_break}}|\'ts\'|"ts")
177177
set:
178178
- - meta_scope: meta.tag.script.begin.html
179-
- include: script-common
180179
- match: '>'
181180
scope: punctuation.definition.tag.end.html
182181
set:
183-
- embed_scope: source.ts.embedded.html
184-
match: '{{script_content_begin}}'
182+
- match: '{{script_content_begin}}'
183+
embed_scope: source.ts.embedded.html
185184
escape_captures:
186185
1: source.ts.embedded.html
187186
2: comment.block.html punctuation.definition.comment.end.html
@@ -192,6 +191,7 @@ contexts:
192191
pop: 1
193192
embed: scope:source.ts
194193
escape: '{{script_content_end}}'
194+
- include: script-common
195195
- tag-generic-attribute-meta
196196
- tag-generic-attribute-value
197197
- match: (?=\S)
@@ -269,12 +269,11 @@ contexts:
269269
- match: (?i)(?=sass{{unquoted_attribute_break}}|\'sass\'|"sass")
270270
set:
271271
- - meta_scope: meta.tag.style.begin.html
272-
- include: style-common
273272
- match: '>'
274273
scope: punctuation.definition.tag.end.html
275274
set:
276-
- embed_scope: source.sass.embedded.html
277-
match: '{{style_content_begin}}'
275+
- match: '{{style_content_begin}}'
276+
embed_scope: source.sass.embedded.html
278277
escape_captures:
279278
1: source.sass.embedded.html
280279
2: comment.block.html punctuation.definition.comment.end.html
@@ -285,17 +284,17 @@ contexts:
285284
pop: 1
286285
embed: scope:source.sass
287286
escape: '{{style_content_end}}'
287+
- include: style-common
288288
- tag-generic-attribute-meta
289289
- tag-generic-attribute-value
290290
- match: (?i)(?=scss{{unquoted_attribute_break}}|\'scss\'|"scss")
291291
set:
292292
- - meta_scope: meta.tag.style.begin.html
293-
- include: style-common
294293
- match: '>'
295294
scope: punctuation.definition.tag.end.html
296295
set:
297-
- embed_scope: source.scss.embedded.html
298-
match: '{{style_content_begin}}'
296+
- match: '{{style_content_begin}}'
297+
embed_scope: source.scss.embedded.html
299298
escape_captures:
300299
1: source.scss.embedded.html
301300
2: comment.block.html punctuation.definition.comment.end.html
@@ -306,17 +305,17 @@ contexts:
306305
pop: 1
307306
embed: scope:source.scss
308307
escape: '{{style_content_end}}'
308+
- include: style-common
309309
- tag-generic-attribute-meta
310310
- tag-generic-attribute-value
311311
- match: (?i)(?=stylus{{unquoted_attribute_break}}|\'stylus\'|"stylus")
312312
set:
313313
- - meta_scope: meta.tag.style.begin.html
314-
- include: style-common
315314
- match: '>'
316315
scope: punctuation.definition.tag.end.html
317316
set:
318-
- embed_scope: source.stylus.embedded.html
319-
match: '{{style_content_begin}}'
317+
- match: '{{style_content_begin}}'
318+
embed_scope: source.stylus.embedded.html
320319
escape_captures:
321320
1: source.stylus.embedded.html
322321
2: comment.block.html punctuation.definition.comment.end.html
@@ -327,17 +326,17 @@ contexts:
327326
pop: 1
328327
embed: scope:source.stylus
329328
escape: '{{style_content_end}}'
329+
- include: style-common
330330
- tag-generic-attribute-meta
331331
- tag-generic-attribute-value
332332
- match: (?i)(?=postcss\?parser=sugarss{{unquoted_attribute_break}}|\'postcss\?parser=sugarss\'|"postcss\?parser=sugarss")
333333
set:
334334
- - meta_scope: meta.tag.style.begin.html
335-
- include: style-common
336335
- match: '>'
337336
scope: punctuation.definition.tag.end.html
338337
set:
339-
- embed_scope: source.sss.embedded.html
340-
match: '{{style_content_begin}}'
338+
- match: '{{style_content_begin}}'
339+
embed_scope: source.sss.embedded.html
341340
escape_captures:
342341
1: source.sss.embedded.html
343342
2: comment.block.html punctuation.definition.comment.end.html
@@ -348,17 +347,17 @@ contexts:
348347
pop: 1
349348
embed: scope:source.sss
350349
escape: '{{style_content_end}}'
350+
- include: style-common
351351
- tag-generic-attribute-meta
352352
- tag-generic-attribute-value
353353
- match: (?i)(?=postcss{{unquoted_attribute_break}}|\'postcss\'|"postcss")
354354
set:
355355
- - meta_scope: meta.tag.style.begin.html
356-
- include: style-common
357356
- match: '>'
358357
scope: punctuation.definition.tag.end.html
359358
set:
360-
- embed_scope: source.postcss.embedded.html
361-
match: '{{style_content_begin}}'
359+
- match: '{{style_content_begin}}'
360+
embed_scope: source.postcss.embedded.html
362361
escape_captures:
363362
1: source.postcss.embedded.html
364363
2: comment.block.html punctuation.definition.comment.end.html
@@ -369,17 +368,17 @@ contexts:
369368
pop: 1
370369
embed: scope:source.postcss
371370
escape: '{{style_content_end}}'
371+
- include: style-common
372372
- tag-generic-attribute-meta
373373
- tag-generic-attribute-value
374374
- match: (?i)(?=less{{unquoted_attribute_break}}|\'less\'|"less")
375375
set:
376376
- - meta_scope: meta.tag.style.begin.html
377-
- include: style-common
378377
- match: '>'
379378
scope: punctuation.definition.tag.end.html
380379
set:
381-
- embed_scope: source.less.embedded.html
382-
match: '{{style_content_begin}}'
380+
- match: '{{style_content_begin}}'
381+
embed_scope: source.less.embedded.html
383382
escape_captures:
384383
1: source.less.embedded.html
385384
2: comment.block.html punctuation.definition.comment.end.html
@@ -390,6 +389,7 @@ contexts:
390389
pop: 1
391390
embed: scope:source.less
392391
escape: '{{style_content_end}}'
392+
- include: style-common
393393
- tag-generic-attribute-meta
394394
- tag-generic-attribute-value
395395
- match: (?=\S)
@@ -449,12 +449,11 @@ contexts:
449449
- match: (?i)(?=jade{{unquoted_attribute_break}}|\'jade\'|"jade")
450450
set:
451451
- - meta_scope: meta.tag.template.begin.html
452-
- include: template-common
453452
- match: '>'
454453
scope: punctuation.definition.tag.end.html
455454
set:
456-
- embed_scope: text.jade.embedded.html
457-
match: '{{template_content_begin}}'
455+
- match: '{{template_content_begin}}'
456+
embed_scope: text.jade.embedded.html
458457
escape_captures:
459458
1: text.jade.embedded.html
460459
2: comment.block.html punctuation.definition.comment.end.html
@@ -465,17 +464,17 @@ contexts:
465464
pop: 1
466465
embed: scope:text.jade
467466
escape: '{{template_content_end}}'
467+
- include: template-common
468468
- tag-generic-attribute-meta
469469
- tag-generic-attribute-value
470470
- match: (?i)(?=pug{{unquoted_attribute_break}}|\'pug\'|"pug")
471471
set:
472472
- - meta_scope: meta.tag.template.begin.html
473-
- include: template-common
474473
- match: '>'
475474
scope: punctuation.definition.tag.end.html
476475
set:
477-
- embed_scope: text.pug.embedded.html
478-
match: '{{template_content_begin}}'
476+
- match: '{{template_content_begin}}'
477+
embed_scope: text.pug.embedded.html
479478
escape_captures:
480479
1: text.pug.embedded.html
481480
2: comment.block.html punctuation.definition.comment.end.html
@@ -486,17 +485,17 @@ contexts:
486485
pop: 1
487486
embed: scope:text.pug
488487
escape: '{{template_content_end}}'
488+
- include: template-common
489489
- tag-generic-attribute-meta
490490
- tag-generic-attribute-value
491491
- match: (?i)(?=slm{{unquoted_attribute_break}}|\'slm\'|"slm")
492492
set:
493493
- - meta_scope: meta.tag.template.begin.html
494-
- include: template-common
495494
- match: '>'
496495
scope: punctuation.definition.tag.end.html
497496
set:
498-
- embed_scope: text.slm.embedded.html
499-
match: '{{template_content_begin}}'
497+
- match: '{{template_content_begin}}'
498+
embed_scope: text.slm.embedded.html
500499
escape_captures:
501500
1: text.slm.embedded.html
502501
2: comment.block.html punctuation.definition.comment.end.html
@@ -507,6 +506,7 @@ contexts:
507506
pop: 1
508507
embed: scope:text.slm
509508
escape: '{{template_content_end}}'
509+
- include: template-common
510510
- tag-generic-attribute-meta
511511
- tag-generic-attribute-value
512512
- match: (?=\S)
@@ -521,7 +521,23 @@ contexts:
521521
- meta_prepend: true
522522
- include: vue-directive
523523

524+
tag-class-attribute-value:
525+
# for compatibility with ST builds before 4114
526+
- meta_prepend: true
527+
- meta_include_prototype: false
528+
524529
tag-generic-attribute-value:
530+
# for compatibility with ST builds before 4114
531+
- meta_prepend: true
532+
- meta_include_prototype: false
533+
534+
tag-href-attribute-value:
535+
# for compatibility with ST builds before 4114
536+
- meta_prepend: true
537+
- meta_include_prototype: false
538+
539+
tag-id-attribute-value:
540+
# for compatibility with ST builds before 4114
525541
- meta_prepend: true
526542
- meta_include_prototype: false
527543

src/macros.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def embed_language_in_tag(tag, match, embed):
1515
set=[
1616
[
1717
_rule(meta_scope='meta.tag.%s.begin.html' % tag),
18-
_rule(include='%s-common' % tag),
1918
_rule(
2019
match='>',
2120
scope='punctuation.definition.tag.end.html',
@@ -38,6 +37,7 @@ def embed_language_in_tag(tag, match, embed):
3837
)
3938
]
4039
),
40+
_rule(include='%s-common' % tag),
4141
],
4242
'tag-generic-attribute-meta',
4343
'tag-generic-attribute-value',

0 commit comments

Comments
 (0)