Skip to content

Commit ed3bf63

Browse files
authored
[PHP] Improve event/style attribute value contexts (sublimehq#3630)
* [PHP] Exclude prototype from event/style attribute values This commit excludes `prototype` from event/style attribute values as those contexts already include inherit syntax which highlights PHP tags well. Injecting prototype just creates duplicate patterns. * [PHP] Split strings into -body/-content This commit makes it easier for inheriting syntax to replace embedded JavaScript/CSS without duplicating all the basic string patterns.
1 parent 24efbbb commit ed3bf63

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

PHP/PHP.sublime-syntax

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,53 +125,71 @@ contexts:
125125
4: comment.block.html punctuation.definition.comment.end.html
126126

127127
tag-event-attribute-value:
128+
- meta_include_prototype: false
128129
- match: \"
129130
scope: string.quoted.double.html punctuation.definition.string.begin.html
130-
set: tag-event-attribute-value-double-quoted-content
131+
set: tag-event-attribute-value-double-quoted-body
131132
- match: \'
132133
scope: string.quoted.single.html punctuation.definition.string.begin.html
133-
set: tag-event-attribute-value-single-quoted-content
134+
set: tag-event-attribute-value-single-quoted-body
134135
- include: else-pop
135136

136-
tag-event-attribute-value-double-quoted-content:
137+
tag-event-attribute-value-double-quoted-body:
138+
- meta_include_prototype: false
137139
- meta_scope: meta.string.html
138140
- meta_content_scope: meta.interpolation.html source.js.embedded.html
139141
- match: \"
140142
scope: string.quoted.double.html punctuation.definition.string.end.html
141143
pop: 1
144+
- include: tag-event-attribute-value-double-quoted-content
145+
146+
tag-event-attribute-value-double-quoted-content:
142147
- include: scope:source.js.embedded.string.quoted.double.php
143148

144-
tag-event-attribute-value-single-quoted-content:
149+
tag-event-attribute-value-single-quoted-body:
150+
- meta_include_prototype: false
145151
- meta_scope: meta.string.html
146152
- meta_content_scope: meta.interpolation.html source.js.embedded.html
147153
- match: \'
148154
scope: string.quoted.single.html punctuation.definition.string.end.html
149155
pop: 1
156+
- include: tag-event-attribute-value-single-quoted-content
157+
158+
tag-event-attribute-value-single-quoted-content:
150159
- include: scope:source.js.embedded.string.quoted.single.php
151160

152161
tag-style-attribute-value:
162+
- meta_include_prototype: false
153163
- match: \"
154164
scope: string.quoted.double.html punctuation.definition.string.begin.html
155-
set: tag-style-attribute-value-double-quoted-content
165+
set: tag-style-attribute-value-double-quoted-body
156166
- match: \'
157167
scope: string.quoted.single.html punctuation.definition.string.begin.html
158-
set: tag-style-attribute-value-single-quoted-content
168+
set: tag-style-attribute-value-single-quoted-body
159169
- include: else-pop
160170

161-
tag-style-attribute-value-double-quoted-content:
171+
tag-style-attribute-value-double-quoted-body:
172+
- meta_include_prototype: false
162173
- meta_scope: meta.string.html
163174
- meta_content_scope: meta.interpolation.html source.css.embedded.html
164175
- match: \"
165176
scope: string.quoted.double.html punctuation.definition.string.end.html
166177
pop: 1
178+
- include: tag-style-attribute-value-double-quoted-content
179+
180+
tag-style-attribute-value-double-quoted-content:
167181
- include: scope:source.css.embedded.string.quoted.double.php
168182

169-
tag-style-attribute-value-single-quoted-content:
183+
tag-style-attribute-value-single-quoted-body:
184+
- meta_include_prototype: false
170185
- meta_scope: meta.string.html
171186
- meta_content_scope: meta.interpolation.html source.css.embedded.html
172187
- match: \'
173188
scope: string.quoted.single.html punctuation.definition.string.end.html
174189
pop: 1
190+
- include: tag-style-attribute-value-single-quoted-content
191+
192+
tag-style-attribute-value-single-quoted-content:
175193
- include: scope:source.css.embedded.string.quoted.single.php
176194

177195
tag-attribute-value-content:

0 commit comments

Comments
 (0)