Skip to content

Commit 1931434

Browse files
committed
Ensure compatibility with future ST releases
caused by sublimehq/Packages#4430
1 parent 569ca39 commit 1931434

File tree

2 files changed

+60
-16
lines changed

2 files changed

+60
-16
lines changed

CoffeeScript Literate.sublime-syntax

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,72 @@ contexts:
3030
embed_scope: meta.embedded.litcoffee source.coffee.embedded.markdown
3131
escape: ^(?=\s*$)
3232

33-
fenced-syntaxes:
34-
- meta_append: true
35-
- include: fenced-coffee
33+
###[ FENCED CODE BLOCKS (NEW STYLE) ]###########################################
3634

37-
fenced-coffee:
35+
fenced-code-block-body:
36+
# requires: https://github.com/sublimehq/Packages/pull/4430
37+
- meta_prepend: true
3838
- match: |-
39-
(?x)
40-
{{fenced_code_block_start}}
41-
(?i:\s*(coffee(?:script)?|cjsx|cson|iced))
42-
{{fenced_code_block_trailing_infostring_characters}}
39+
(?xi)
40+
[ \t]*
41+
(coffee(?:script)?|cjsx|cson|iced)
42+
(?=[ \t\n;:])
4343
captures:
44-
0: meta.code-fence.definition.begin.markdown-gfm
45-
2: punctuation.definition.raw.code-fence.begin.markdown
46-
5: constant.other.language-name.markdown
47-
6: comment.line.infostring.markdown
48-
7: meta.fold.code-fence.begin.markdown
44+
1: constant.other.language-name.markdown
45+
push:
46+
- fenced-code-block-coffee-content
47+
- fenced-code-block-coffee-infostring
48+
49+
fenced-code-block-coffee-infostring:
50+
- meta_include_prototype: false
51+
- meta_scope: meta.code-fence.definition.begin.markdown-gfm
52+
- meta_content_scope: comment.line.infostring.markdown
53+
- match: \s*$\n?
54+
scope: meta.fold.code-fence.begin.markdown
55+
pop: 1
56+
- match: \{
57+
scope: punctuation.definition.attributes.begin.markdown
58+
push: fenced-code-block-coffee-infostring-attributes
59+
60+
fenced-code-block-coffee-infostring-attributes:
61+
- meta_scope: meta.attributes.markdown
62+
- include: tag-attributes
63+
64+
fenced-code-block-coffee-content:
65+
- meta_include_prototype: false
66+
- match: ^
4967
embed: scope:source.coffee
5068
embed_scope:
51-
meta.code-fence.body.markdown.markdown-gfm
69+
meta.code-fence.body.markdown-gfm
5270
markup.raw.code-fence.coffee.markdown-gfm
5371
source.coffee
54-
escape: '{{fenced_code_block_escape}}'
72+
escape: (?!)
73+
74+
###[ FENCED CODE BLOCKS (OLD STYLE) ]###########################################
75+
76+
fenced-syntaxes:
77+
# required until ST4202
78+
- meta_append: true
79+
- match: |-
80+
(?x)
81+
[ \t]* # leading whitespace
82+
( (`)``+(?![^`]*`) | (~)~~+ ) # punctuation
83+
((?i:coffee(?:script)?|cjsx|cson|iced)) # language identifier
84+
(?: (?: \s+ | (?=[:;]) ) (\S.*?) )? # remaining infostring
85+
(\s*$\n?) # fold marker
86+
captures:
87+
0: meta.code-fence.definition.begin.markdown-gfm
88+
1: punctuation.definition.raw.code-fence.begin.markdown
89+
4: constant.other.language-name.markdown
90+
5: comment.line.infostring.markdown
91+
6: meta.fold.code-fence.begin.markdown
92+
embed: scope:source.coffee
93+
embed_scope: markup.raw.code-fence.markdown-gfm source.coffee
94+
escape: |-
95+
(?x)
96+
^[ \t]* # leading whitespace
97+
( \1 (?:(?:\2)*|(?:\3)*) ) # punctuation
98+
(\s*$\n?) # fold marker
5599
escape_captures:
56100
0: meta.code-fence.definition.end.markdown-gfm
57101
1: punctuation.definition.raw.code-fence.end.markdown

tests/syntax_test_scope.litcoffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ into a .litcoffee file and open it in Sublime to see the breakage.
6666
|^^ punctuation.definition.raw.code-fence.begin.markdown
6767
| ^^^^^^ constant.other.language-name.markdown
6868
69-
| <- text.html.markdown.litcoffee meta.code-fence.body.markdown.markdown-gfm markup.raw.code-fence.coffee.markdown-gfm source.coffee
69+
| <- text.html.markdown.litcoffee markup.raw.code-fence source.coffee
7070
```
7171
| <- text.html.markdown.litcoffee meta.code-fence.definition.end.markdown-gfm punctuation.definition.raw.code-fence.end.markdown
7272
|^^ text.html.markdown.litcoffee meta.code-fence.definition.end.markdown-gfm punctuation.definition.raw.code-fence.end.markdown

0 commit comments

Comments
 (0)