-
Notifications
You must be signed in to change notification settings - Fork 64
/
HTML (CoffeeScript).sublime-syntax
100 lines (87 loc) · 3.17 KB
/
HTML (CoffeeScript).sublime-syntax
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
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
name: HTML (CoffeeScript)
scope: text.html.coffee
version: 2
extends: Packages/HTML/HTML.sublime-syntax
file_extensions:
- coffee.html
contexts:
script-common:
- meta_prepend: true
- match: (?i:lang(?:uage)?){{attribute_name_break}}
scope: meta.attribute-with-value.lang.html entity.other.attribute-name.html
set: script-lang-attribute-assignment
script-lang-attribute-assignment:
- meta_content_scope: meta.tag.script.begin.html meta.attribute-with-value.lang.html
- match: =
scope: punctuation.separator.key-value.html
set: script-lang-attribute-value
- match: (?=\S)
set: script-javascript
script-lang-attribute-value:
- meta_include_prototype: false
- meta_scope: meta.tag.script.begin.html meta.attribute-with-value.lang.html
- match: (?=(?i:coffee(?:script)?{{unquoted_attribute_break}}|'coffee(?:script)?'|"coffee(?:script)?"))
set:
- script-coffee
- tag-lang-attribute-meta
- tag-generic-attribute-value
- match: (?=\S)
set:
- script-javascript
- tag-lang-attribute-meta
- tag-generic-attribute-value
tag-lang-attribute-meta:
- meta_include_prototype: false
- meta_scope: meta.attribute-with-value.lang.html
- include: immediately-pop
script-type-decider:
- meta_prepend: true
- match: (?={{coffee_mime_type}}{{unquoted_attribute_break}}|'{{coffee_mime_type}}'|"{{coffee_mime_type}}")
set:
- script-coffee
- tag-type-attribute-meta
- tag-generic-attribute-value
tag-type-attribute-meta:
# required until ST4184
- meta_include_prototype: false
- meta_scope: meta.attribute-with-value.type.html
- include: immediately-pop
script-coffee:
- meta_include_prototype: false
- meta_scope: meta.tag.script.begin.html
- match: '>'
scope: punctuation.definition.tag.end.html
set: script-coffee-content
- include: script-common
script-coffee-content:
- meta_include_prototype: false
- match: \s*((<!\[)(CDATA)(\[))
captures:
1: meta.tag.sgml.cdata.html
2: punctuation.definition.tag.begin.html
3: keyword.declaration.cdata.html
4: punctuation.definition.tag.begin.html
pop: 1 # make sure to match only once
embed: scope:source.coffee
embed_scope: meta.tag.sgml.cdata.html source.coffee.embedded.html
escape: \]\]>
escape_captures:
0: meta.tag.sgml.cdata.html punctuation.definition.tag.end.html
- match: '{{script_content_begin}}'
captures:
1: comment.block.html punctuation.definition.comment.begin.html
pop: 1 # make sure to match only once
embed: scope:source.coffee
embed_scope: source.coffee.embedded.html
escape: '{{script_content_end}}'
escape_captures:
1: source.coffee.embedded.html
2: comment.block.html punctuation.definition.comment.end.html
3: source.coffee.embedded.html
4: comment.block.html punctuation.definition.comment.end.html
variables:
coffee_mime_type: |-
(?xi: (?: (?: application | text ) / coffee(?:script)? ) {{mime_type_parameters}}? )