Skip to content

Commit b9b6123

Browse files
committed
Support template expressions in cfmail body
fixes #102
1 parent f7dd161 commit b9b6123

File tree

3 files changed

+61
-24
lines changed

3 files changed

+61
-24
lines changed

syntaxes/cfml.sublime-syntax

+28-12
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ contexts:
3838
- include: comments
3939
- include: cffunction
4040
- include: cfoutput
41+
- include: cfmail
4142
- include: cfquery
4243
- include: tags-with-script
4344
- include: cfscript
@@ -300,29 +301,44 @@ contexts:
300301
scope: punctuation.definition.tag.end.cfml
301302
set:
302303
- meta_content_scope: meta.scope.cfoutput.cfml text.html.cfml
303-
- include: cfoutput-end-pop
304-
- include: cfoutput-html
304+
- include: cftag-end-pop
305+
- include: template-expression-html
305306
- include: tag-generic-attribute
306307

307-
cfoutput-html:
308-
- match: (?=\S)
308+
cfmail:
309+
- match: (?i)(<)(cfmail)
310+
captures:
311+
1: punctuation.definition.tag.begin.cfml
312+
2: entity.name.tag.cfml
309313
push:
310-
- include: scope:text.html.basic
311-
with_prototype:
312-
- match: (?i)(?=</cfoutput>)
313-
pop: true
314-
- include: template-expression
315-
- include: cfmltags
314+
- meta_scope: meta.tag.cfml
315+
- match: '>'
316+
scope: punctuation.definition.tag.end.cfml
317+
set:
318+
- meta_content_scope: meta.scope.cfmail.cfml text.html.cfml
319+
- include: cftag-end-pop
320+
- include: template-expression-html
321+
- include: tag-generic-attribute
316322

317-
cfoutput-end-pop:
318-
- match: (?i)(</)(cfoutput)(>)
323+
cftag-end-pop:
324+
- match: (?i)(</)(cf[a-z]+)(>)
319325
captures:
320326
0: meta.tag.cfml
321327
1: punctuation.definition.tag.begin.cfml
322328
2: entity.name.tag.cfml
323329
3: punctuation.definition.tag.end.cfml
324330
pop: true
325331

332+
template-expression-html:
333+
- match: (?=\S)
334+
push:
335+
- include: scope:text.html.basic
336+
with_prototype:
337+
- match: (?i)(?=</cf(output|mail)>)
338+
pop: true
339+
- include: template-expression
340+
- include: cfmltags
341+
326342
cfproperty:
327343
- match: (?i)(<)(cfproperty)\b
328344
captures:

syntaxes/cfml.sublime-syntax.yaml-macros

+28-12
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ contexts:
3939
- include: comments
4040
- include: cffunction
4141
- include: cfoutput
42+
- include: cfmail
4243
- include: cfquery
4344
- include: tags-with-script
4445
- include: cfscript
@@ -164,29 +165,44 @@ contexts:
164165
scope: punctuation.definition.tag.end.cfml
165166
set:
166167
- meta_content_scope: meta.scope.cfoutput.cfml text.html.cfml
167-
- include: cfoutput-end-pop
168-
- include: cfoutput-html
168+
- include: cftag-end-pop
169+
- include: template-expression-html
169170
- include: tag-generic-attribute
170171

171-
cfoutput-html:
172-
- match: (?=\S)
172+
cfmail:
173+
- match: (?i)(<)(cfmail)
174+
captures:
175+
1: punctuation.definition.tag.begin.cfml
176+
2: entity.name.tag.cfml
173177
push:
174-
- include: scope:text.html.basic
175-
with_prototype:
176-
- match: (?i)(?=</cfoutput>)
177-
pop: true
178-
- include: template-expression
179-
- include: cfmltags
178+
- meta_scope: meta.tag.cfml
179+
- match: '>'
180+
scope: punctuation.definition.tag.end.cfml
181+
set:
182+
- meta_content_scope: meta.scope.cfmail.cfml text.html.cfml
183+
- include: cftag-end-pop
184+
- include: template-expression-html
185+
- include: tag-generic-attribute
180186

181-
cfoutput-end-pop:
182-
- match: (?i)(</)(cfoutput)(>)
187+
cftag-end-pop:
188+
- match: (?i)(</)(cf[a-z]+)(>)
183189
captures:
184190
0: meta.tag.cfml
185191
1: punctuation.definition.tag.begin.cfml
186192
2: entity.name.tag.cfml
187193
3: punctuation.definition.tag.end.cfml
188194
pop: true
189195

196+
template-expression-html:
197+
- match: (?=\S)
198+
push:
199+
- include: scope:text.html.basic
200+
with_prototype:
201+
- match: (?i)(?=</cf(output|mail)>)
202+
pop: true
203+
- include: template-expression
204+
- include: cfmltags
205+
190206
cfproperty:
191207
- match: (?i)(<)(cfproperty)\b
192208
captures:

syntaxes/tests/syntax_test_cfml.cfm

+5
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@
7474
<cfquery>BULK INSERT VAR1 FROM 'C:\#path#'</cfquery>
7575
<!--- ^ source.sql string.quoted.single.sql constant.character.escape.sql --->
7676
<!--- ^ source.sql string.quoted.single.sql punctuation.definition.template-expression.begin.cfml --->
77+
78+
<cfmail>
79+
#variable#
80+
<!--- ^ meta.scope.cfmail.cfml text.html.cfml source.cfml.script variable.other.readwrite.cfml --->
81+
</cfmail>
7782
<cfscript>
7883
foo = 'hello world';
7984
<!--- <- embedding.cfml text.html.cfml source.cfml.script variable.other.readwrite.cfml --->

0 commit comments

Comments
 (0)