Skip to content

Commit d58e79e

Browse files
authored
Rewrite syntax extending HTML (#8)
This commit ... 1. replaces `push...with_prototype` by extending HTML, CSS and JavaScript. 2. adds support for $TEMPLATE_START and $TEMPLATE_END snippet variables, to avoid duplicated snippet variables or key bindings. 3. adds support to toggle `<%# %>` comments 4. removes `<$ $>` and `<@ @>` variants, keeping only most commonly used ones. Actually EJS supports anything (even `[% %]` or `{% %}` all of which is impossible to support at the same time via static syntax definitions. It would make more sense to dynamically create them via templates. 5. drops Dracula Color scheme as color schemes should not be bundled with syntax definitions and syntax only uses scopes according to ST's scope naming guide. It should be easily possible for original Dracula color scheme to support them.
1 parent 097066f commit d58e79e

42 files changed

Lines changed: 1458 additions & 1100 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.github/ export-ignore
2+
/.gitattributes export-ignore
3+
/.gitignore export-ignore
4+
syntax_test_* export-ignore
5+
preview.* export-ignore
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI Syntax Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags-ignore:
8+
- '**'
9+
paths:
10+
- '.github/workflows/ci-syntax-tests.yml'
11+
- '**.sublime-syntax'
12+
- '**/syntax_test_*'
13+
pull_request:
14+
paths:
15+
- '.github/workflows/ci-syntax-tests.yml'
16+
- '**.sublime-syntax'
17+
- '**/syntax_test_*'
18+
workflow_dispatch:
19+
20+
jobs:
21+
syntax_tests:
22+
name: Sublime Text ${{ matrix.build }}
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 15 # default is 6 hours!
25+
strategy:
26+
matrix:
27+
include:
28+
# Stable ST4 builds
29+
- build: 4152
30+
default_packages: binary
31+
- build: 4169
32+
default_packages: binary
33+
- build: 4180
34+
default_packages: binary
35+
- build: 4192
36+
default_packages: binary
37+
# Latest dev build (and latest available maybe unreleased syntaxes)
38+
- build: latest
39+
default_packages: master
40+
steps:
41+
- name: Checkout EJS
42+
uses: actions/checkout@v4
43+
with:
44+
path: EJS
45+
- uses: SublimeText/syntax-test-action@v2
46+
with:
47+
build: ${{ matrix.build }}
48+
package_name: EJS
49+
package_root: EJS
50+
default_packages: ${{ matrix.default_packages }}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# MacOS specific ignores
2+
.DS_Store
3+
4+
# development
5+
.sublime/
6+
.venv/
7+
.vscode/
8+
9+
# python cache files
10+
__pycache__/
11+
*.pyc

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.8

Default.sublime-keymap

Lines changed: 8 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// <% %>
44
{ "keys": ["%"], "command": "insert_snippet", "args": {"contents": "%${0: }%>"}, "context":
55
[
6-
{ "key": "selector", "operand": "text.ejs.percentsign - source.js", "match_all": true },
6+
{ "key": "selector", "operand": "text.html.ejs - text.html.ejs source.js", "match_all": true },
77
{ "key": "setting.auto_match_enabled", "operand": true },
88
{ "key": "selection_empty", "operand": true, "match_all": true },
99
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true },
@@ -13,108 +13,33 @@
1313
// <? ?>
1414
{ "keys": ["?"], "command": "insert_snippet", "args": {"contents": "?${0: }?>"}, "context":
1515
[
16-
{ "key": "selector", "operand": "text.ejs.questionmark - source.js", "match_all": true },
16+
{ "key": "selector", "operand": "text.html.ejs.questionmark - text.html.ejs source.js", "match_all": true },
1717
{ "key": "setting.auto_match_enabled", "operand": true },
1818
{ "key": "selection_empty", "operand": true, "match_all": true },
1919
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true },
20-
{ "key": "following_text", "operator": "not_regex_contains", "operand": "^[?=_#>-]", "match_all": true }
21-
]
22-
},
23-
// <$ $>
24-
{ "keys": ["$"], "command": "insert_snippet", "args": {"contents": "\\$${0: }\\$>"}, "context":
25-
[
26-
{ "key": "selector", "operand": "text.ejs.dollarsign - source.js", "match_all": true },
27-
{ "key": "setting.auto_match_enabled", "operand": true },
28-
{ "key": "selection_empty", "operand": true, "match_all": true },
29-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true },
30-
{ "key": "following_text", "operator": "not_regex_contains", "operand": "^[$=_#>-]", "match_all": true }
31-
]
32-
},
33-
// <@ @>
34-
{ "keys": ["@"], "command": "insert_snippet", "args": {"contents": "@${0: }@>"}, "context":
35-
[
36-
{ "key": "selector", "operand": "text.ejs.atsign - source.js", "match_all": true },
37-
{ "key": "setting.auto_match_enabled", "operand": true },
38-
{ "key": "selection_empty", "operand": true, "match_all": true },
39-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true },
40-
{ "key": "following_text", "operator": "not_regex_contains", "operand": "^[@=_#>-]", "match_all": true }
20+
{ "key": "following_text", "operator": "not_regex_contains", "operand": "^[%=_#>-]", "match_all": true }
4121
]
4222
},
23+
4324
// Auto-indent
4425
// <% %>
4526
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
4627
[
47-
{ "key": "selector", "operand": "text.ejs.percentsign - source.js", "match_all": true },
28+
{ "key": "selector", "operand": "text.html.ejs", "match_all": true },
4829
{ "key": "setting.auto_indent", "operand": true },
4930
{ "key": "selection_empty", "operand": true, "match_all": true },
50-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<%(?!%)[=_#-]?\\s*$", "match_all": true },
51-
{ "key": "following_text", "operator": "regex_contains", "operand": "^[_-]?%>", "match_all": true }
52-
]
53-
},
54-
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
55-
[
56-
{ "key": "selector", "operand": "text.ejs.percentsign punctuation.definition.js.end.ejs", "match_all": true },
57-
{ "key": "setting.auto_indent", "operand": true },
58-
{ "key": "selection_empty", "operand": false, "match_all": true },
59-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<%(?!%)[=_#-]?\\s*$", "match_all": true },
31+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<%[#=_-]?\\s*$", "match_all": true },
6032
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\s*[_-]?%>", "match_all": true }
6133
]
6234
},
6335
// <? ?>
6436
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
6537
[
66-
{ "key": "selector", "operand": "text.ejs.questionmark - source.js", "match_all": true },
38+
{ "key": "selector", "operand": "text.html.ejs.questionmark", "match_all": true },
6739
{ "key": "setting.auto_indent", "operand": true },
6840
{ "key": "selection_empty", "operand": true, "match_all": true },
69-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<\\?(?!\\?)[=_#-]?\\s*$", "match_all": true },
70-
{ "key": "following_text", "operator": "regex_contains", "operand": "^[_-]?\\?>", "match_all": true }
71-
]
72-
},
73-
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
74-
[
75-
{ "key": "selector", "operand": "text.ejs.questionmark punctuation.definition.js.end.ejs", "match_all": true },
76-
{ "key": "setting.auto_indent", "operand": true },
77-
{ "key": "selection_empty", "operand": false, "match_all": true },
78-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<\\?(?!\\?)[=_#-]?\\s*$", "match_all": true },
41+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<\\?[#=_-]?\\s*$", "match_all": true },
7942
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\s*[_-]?\\?>", "match_all": true }
8043
]
8144
},
82-
// <$ $>
83-
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
84-
[
85-
{ "key": "selector", "operand": "text.ejs.dollarsign - source.js", "match_all": true },
86-
{ "key": "setting.auto_indent", "operand": true },
87-
{ "key": "selection_empty", "operand": true, "match_all": true },
88-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<\\$(?!\\$)[=_#-]?\\s*$", "match_all": true },
89-
{ "key": "following_text", "operator": "regex_contains", "operand": "^[_-]?\\$>", "match_all": true }
90-
]
91-
},
92-
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
93-
[
94-
{ "key": "selector", "operand": "text.ejs.dollarsign punctuation.definition.js.end.ejs", "match_all": true },
95-
{ "key": "setting.auto_indent", "operand": true },
96-
{ "key": "selection_empty", "operand": false, "match_all": true },
97-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<\\$(?!\\$)[=_#-]?\\s*$", "match_all": true },
98-
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\s*[_-]?\\$>", "match_all": true }
99-
]
100-
},
101-
// <@ @>
102-
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
103-
[
104-
{ "key": "selector", "operand": "text.ejs.atsign - source.js", "match_all": true },
105-
{ "key": "setting.auto_indent", "operand": true },
106-
{ "key": "selection_empty", "operand": true, "match_all": true },
107-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<@(?!@)[=_#-]?\\s*$", "match_all": true },
108-
{ "key": "following_text", "operator": "regex_contains", "operand": "^[_-]?@>", "match_all": true }
109-
]
110-
},
111-
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
112-
[
113-
{ "key": "selector", "operand": "text.ejs.atsign punctuation.definition.js.end.ejs", "match_all": true },
114-
{ "key": "setting.auto_indent", "operand": true },
115-
{ "key": "selection_empty", "operand": false, "match_all": true },
116-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<@(?!@)[=_#-]?\\s*$", "match_all": true },
117-
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\s*[_-]?@>", "match_all": true }
118-
]
119-
}
12045
]

0 commit comments

Comments
 (0)