Skip to content

Commit 6711955

Browse files
author
Michael Lyons
committed
Fix embedding within attribute tags
1 parent e083653 commit 6711955

6 files changed

+103
-30
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ The old ASP.Net style pages that necessitated creation of this package. Post-Vis
3232

3333
### Known issues
3434

35-
- Code blocks in CSS and JavaScript attributes that contain the opening attribute delimiter are prematurely terminated.
36-
37-
```
38-
<p style="color: <%= "red" %>" ></p>
39-
<p onclick="<%= "alert('hi!')" %>"></p>
40-
```
35+
- Nothing yet? &#x1f91e;
4136

4237

4338
## Razor

WebForms/WebForms.sublime-syntax

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -286,38 +286,54 @@ contexts:
286286

287287
tag-event-attribute-value:
288288
- match: \"
289-
scope: meta.string.html string.quoted.double.html punctuation.definition.string.begin.html
290-
embed: scope:source.js.cs.webforms
291-
embed_scope: meta.string.html meta.interpolation.html source.js.embedded.html
292-
escape: \"
293-
escape_captures:
294-
0: meta.string.html string.quoted.double.html punctuation.definition.string.end.html
289+
scope: string.quoted.double.html punctuation.definition.string.begin.html
290+
set: tag-event-attribute-value-double-quoted-content
295291
- match: \'
296-
scope: meta.string.html string.quoted.single.html punctuation.definition.string.begin.html
297-
embed: scope:source.js.cs.webforms
298-
embed_scope: meta.string.html meta.interpolation.html source.js.embedded.html
299-
escape: \'
300-
escape_captures:
301-
0: meta.string.html string.quoted.single.html punctuation.definition.string.end.html
292+
scope: string.quoted.single.html punctuation.definition.string.begin.html
293+
set: tag-event-attribute-value-single-quoted-content
302294
- include: else-pop
303295

296+
tag-event-attribute-value-double-quoted-content:
297+
- meta_scope: meta.string.html
298+
- meta_content_scope: meta.interpolation.html source.js.embedded.html
299+
- match: \"
300+
scope: string.quoted.double.html punctuation.definition.string.end.html
301+
pop: 1
302+
- include: scope:source.js.embedded.string.quoted.double.cs.webforms
303+
304+
tag-event-attribute-value-single-quoted-content:
305+
- meta_scope: meta.string.html
306+
- meta_content_scope: meta.interpolation.html source.js.embedded.html
307+
- match: \'
308+
scope: string.quoted.single.html punctuation.definition.string.end.html
309+
pop: 1
310+
- include: scope:source.js.embedded.string.quoted.single.cs.webforms
311+
304312
tag-style-attribute-value:
305313
- match: \"
306-
scope: meta.string.html string.quoted.double.html punctuation.definition.string.begin.html
307-
embed: scope:source.css.cs.webforms#rule-list-body
308-
embed_scope: meta.string.html meta.interpolation.html source.css.embedded.html
309-
escape: \"
310-
escape_captures:
311-
0: meta.string.html string.quoted.double.html punctuation.definition.string.end.html
314+
scope: string.quoted.double.html punctuation.definition.string.begin.html
315+
set: tag-style-attribute-value-double-quoted-content
312316
- match: \'
313-
scope: meta.string.html string.quoted.single.html punctuation.definition.string.begin.html
314-
embed: scope:source.css.cs.webforms#rule-list-body
315-
embed_scope: meta.string.html meta.interpolation.html source.css.embedded.html
316-
escape: \'
317-
escape_captures:
318-
0: meta.string.html string.quoted.single.html punctuation.definition.string.end.html
317+
scope: string.quoted.single.html punctuation.definition.string.begin.html
318+
set: tag-style-attribute-value-single-quoted-content
319319
- include: else-pop
320320

321+
tag-style-attribute-value-double-quoted-content:
322+
- meta_scope: meta.string.html
323+
- meta_content_scope: meta.interpolation.html source.css.embedded.html
324+
- match: \"
325+
scope: string.quoted.double.html punctuation.definition.string.end.html
326+
pop: 1
327+
- include: scope:source.css.embedded.string.quoted.double.cs.webforms
328+
329+
tag-style-attribute-value-single-quoted-content:
330+
- meta_scope: meta.string.html
331+
- meta_content_scope: meta.interpolation.html source.css.embedded.html
332+
- match: \'
333+
scope: string.quoted.single.html punctuation.definition.string.end.html
334+
pop: 1
335+
- include: scope:source.css.embedded.string.quoted.single.cs.webforms
336+
321337
tag-attribute-value-content:
322338
- meta_prepend: true
323339
- include: csharp-interpolations
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
%YAML 1.2
2+
---
3+
scope: source.css.embedded.string.quoted.double.cs.webforms
4+
version: 2
5+
hidden: true
6+
7+
extends: Packages/HTML (C#)/WebForms/CSS (WebForms).sublime-syntax
8+
9+
contexts:
10+
11+
prototype:
12+
- meta_prepend: true
13+
- match: (?=")
14+
pop: 1
15+
16+
main:
17+
- include: rule-list-body
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
%YAML 1.2
2+
---
3+
scope: source.css.embedded.string.quoted.single.cs.webforms
4+
version: 2
5+
hidden: true
6+
7+
extends: Packages/HTML (C#)/WebForms/CSS (WebForms).sublime-syntax
8+
9+
contexts:
10+
11+
prototype:
12+
- meta_prepend: true
13+
- match: (?=')
14+
pop: 1
15+
16+
main:
17+
- include: rule-list-body
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%YAML 1.2
2+
---
3+
scope: source.js.embedded.string.quoted.double.cs.webforms
4+
version: 2
5+
hidden: true
6+
7+
extends: Packages/HTML (C#)/WebForms/JavaScript (WebForms).sublime-syntax
8+
9+
contexts:
10+
11+
prototype:
12+
- meta_prepend: true
13+
- match: (?=")
14+
pop: 1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%YAML 1.2
2+
---
3+
scope: source.js.embedded.string.quoted.single.cs.webforms
4+
version: 2
5+
hidden: true
6+
7+
extends: Packages/HTML (C#)/WebForms/JavaScript (WebForms).sublime-syntax
8+
9+
contexts:
10+
11+
prototype:
12+
- meta_prepend: true
13+
- match: (?=')
14+
pop: 1

0 commit comments

Comments
 (0)