Skip to content

Commit d049a56

Browse files
committed
fix(nested.html): interpolated attribute names
1 parent 1f9d09c commit d049a56

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

nested/build/base-packages/HTML/HTML.sublime-syntax

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ contexts:
203203
scope: punctuation.definition.tag.end.html
204204
pop: true
205205
- include: tag-attributes
206-
- match: '(</?)(?=\${)'
206+
- match: '(</?)(?=\$\{)'
207207
captures:
208208
'1': punctuation.definition.tag.begin.html
209209
push:
@@ -400,7 +400,7 @@ contexts:
400400
pop: true
401401
- include: entities
402402
tag-generic-attribute:
403-
- match: '(?={{attribute_char}})'
403+
- match: '(?={{attribute_char}}|=)'
404404
scope: entity.other.attribute-name.html
405405
push:
406406
- tag-generic-attribute-meta

nested/src/syntax.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ const h_syntax_transforms = {
4848
a_rules.splice(1, 0, interp_escape_lookahead());
4949
},
5050

51+
// allow for empty attribute names so they can be interpolated
52+
'$.contexts["tag-generic-attribute"][0]': (g_rule) => {
53+
g_rule.match = g_rule.match.replace(/(\)?)$/, '|=$1');
54+
},
55+
5156
'$.contexts': (h_contexts) => {
5257
// each context
5358
for(let [si_context, a_rules] of Object.entries(h_contexts)) {

0 commit comments

Comments
 (0)