-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEJS.sublime-syntax
More file actions
151 lines (122 loc) · 4.56 KB
/
EJS.sublime-syntax
File metadata and controls
151 lines (122 loc) · 4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
%YAML 1.2
---
# https://github.com/mde/ejs
name: EJS <% %>
scope: text.html.ejs
version: 2
extends: Packages/HTML/HTML.sublime-syntax
file_extensions:
- ejs
variables:
# HTML variables
tag_name_start: (?:[A-Za-z]|{{ejs_tag_start}})
# EJS variables
ejs_delimiter: '%'
ejs_commet_start: '<{{ejs_delimiter}}#'
ejs_tag_start: '<{{ejs_delimiter}}(?:[=_-]|(?!{{ejs_delimiter}}[^>]))'
ejs_tag_end: '[_-]?{{ejs_delimiter}}>'
contexts:
###[ HTML OVERRIDES ]#########################################################
prototype:
- meta_prepend: true
- include: ejs-embedded
tag-other:
# required until PR #3980 (ST 4175)
- match: </?(?={{tag_name_start}})
scope: punctuation.definition.tag.begin.html
push:
- tag-other-content
- tag-other-name
style-css-content:
- meta_include_prototype: false
- match: '{{style_content_begin}}'
captures:
1: comment.block.html punctuation.definition.comment.begin.html
pop: 1 # make sure to match only once
embed: scope:source.css.embedded.html.ejs
embed_scope: source.css.embedded.html
escape: '{{style_content_end}}'
escape_captures:
1: source.css.embedded.html
2: comment.block.html punctuation.definition.comment.end.html
3: source.css.embedded.html
4: comment.block.html punctuation.definition.comment.end.html
tag-attribute-value-content:
- meta_prepend: true
- include: ejs-interpolations
strings-common-content:
- meta_prepend: true
- include: ejs-interpolations
###[ STYLE ATTRIBUTES ]########################################################
tag-style-attribute-value:
- meta_include_prototype: false
- match: \"
scope: meta.string.html string.quoted.double.html punctuation.definition.string.begin.html
set: tag-style-attribute-double-quoted-value
- match: \'
scope: meta.string.html string.quoted.single.html punctuation.definition.string.begin.html
set: tag-style-attribute-single-quoted-value
- include: else-pop
tag-style-attribute-double-quoted-value:
- meta_include_prototype: false
- meta_content_scope: meta.string.html meta.interpolation.html source.css.embedded.html
- match: \"
scope: meta.string.html string.quoted.double.html punctuation.definition.string.end.html
pop: 1
- include: tag-style-attribute-double-quoted-value-content
tag-style-attribute-double-quoted-value-content:
- include: scope:source.css.embedded.html.ejs.double-quoted
apply_prototype: true
tag-style-attribute-single-quoted-value:
- meta_include_prototype: false
- meta_content_scope: meta.string.html meta.interpolation.html source.css.embedded.html
- match: \'
scope: meta.string.html string.quoted.single.html punctuation.definition.string.end.html
pop: 1
- include: tag-style-attribute-single-quoted-value-content
tag-style-attribute-single-quoted-value-content:
- include: scope:source.css.embedded.html.ejs.single-quoted
apply_prototype: true
###[ EJS TAGS ]###############################################################
ejs-embedded:
- match: '{{ejs_commet_start}}'
scope: punctuation.definition.comment.begin.ejs
push: ejs-embedded-comment-body
- match: '{{ejs_tag_start}}'
scope: punctuation.section.embedded.begin.ejs
push: ejs-embedded-body
ejs-embedded-comment-body:
- meta_include_prototype: false
- meta_scope: meta.embedded.ejs comment.block.ejs
- match: '{{ejs_tag_end}}'
scope: punctuation.definition.comment.end.ejs
pop: 1
ejs-embedded-body:
- meta_include_prototype: false
- meta_scope: meta.embedded.ejs
- meta_content_scope: source.js.embedded.ejs
- match: '{{ejs_tag_end}}'
scope: punctuation.section.embedded.end.ejs
pop: 1
- include: ejs-content
ejs-interpolations:
- match: '{{ejs_commet_start}}'
scope: punctuation.definition.comment.begin.ejs
push: ejs-interpolation-comment-body
- match: '{{ejs_tag_start}}'
scope: punctuation.section.embedded.begin.ejs
push: ejs-interpolation-body
ejs-interpolation-comment-body:
- clear_scopes: 1
- meta_include_prototype: false
- meta_scope: meta.embedded.ejs comment.block.ejs
- include: ejs-embedded-comment-body
ejs-interpolation-body:
- clear_scopes: 1
- meta_include_prototype: false
- meta_scope: meta.embedded.ejs
- meta_content_scope: source.js.embedded.ejs
- include: ejs-embedded-body
ejs-content:
- include: JavaScript (for EJS P).sublime-syntax
apply_prototype: true