@@ -0,0 +1,142 @@
1+{
2+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+ "name": "htmlang",
4+ "scopeName": "source.htmlang",
5+ "patterns": [
6+ { "include": "#comment" },
7+ { "include": "#raw-block" },
8+ { "include": "#page-directive" },
9+ { "include": "#let-definition" },
10+ { "include": "#define-definition" },
11+ { "include": "#fn-definition" },
12+ { "include": "#include-directive" },
13+ { "include": "#element" },
14+ { "include": "#function-call" },
15+ { "include": "#variable" },
16+ { "include": "#attributes" },
17+ { "include": "#inline-element" },
18+ { "include": "#color" },
19+ { "include": "#number" }
20+ ],
21+ "repository": {
22+ "comment": {
23+ "name": "comment.line.double-dash.htmlang",
24+ "match": "^\\s*--.*$"
25+ },
26+ "raw-block": {
27+ "name": "meta.raw.htmlang",
28+ "begin": "(@raw)\\s+(\"\"\")",
29+ "end": "(\"\"\")",
30+ "beginCaptures": {
31+ "1": { "name": "entity.name.tag.htmlang" },
32+ "2": { "name": "punctuation.definition.string.begin.htmlang" }
33+ },
34+ "endCaptures": {
35+ "1": { "name": "punctuation.definition.string.end.htmlang" }
36+ },
37+ "contentName": "string.unquoted.raw.htmlang"
38+ },
39+ "page-directive": {
40+ "match": "(@page)\\s+(.*)",
41+ "captures": {
42+ "1": { "name": "keyword.control.directive.htmlang" },
43+ "2": { "name": "string.unquoted.page-title.htmlang" }
44+ }
45+ },
46+ "let-definition": {
47+ "match": "(@let)\\s+([a-zA-Z_][a-zA-Z0-9_-]*)",
48+ "captures": {
49+ "1": { "name": "keyword.control.directive.htmlang" },
50+ "2": { "name": "variable.other.htmlang" }
51+ }
52+ },
53+ "define-definition": {
54+ "match": "(@define)\\s+([a-zA-Z_][a-zA-Z0-9_-]*)",
55+ "captures": {
56+ "1": { "name": "keyword.control.directive.htmlang" },
57+ "2": { "name": "variable.other.constant.htmlang" }
58+ }
59+ },
60+ "fn-definition": {
61+ "match": "(@fn)\\s+([a-zA-Z_][a-zA-Z0-9_-]*)",
62+ "captures": {
63+ "1": { "name": "keyword.control.directive.htmlang" },
64+ "2": { "name": "entity.name.function.definition.htmlang" }
65+ }
66+ },
67+ "include-directive": {
68+ "match": "(@include)\\s+(.*)",
69+ "captures": {
70+ "1": { "name": "keyword.control.directive.htmlang" },
71+ "2": { "name": "string.unquoted.filename.htmlang" }
72+ }
73+ },
74+ "element": {
75+ "name": "entity.name.tag.htmlang",
76+ "match": "@(?:row|column|col|el|text|paragraph|p|image|img|link|raw|children)\\b"
77+ },
78+ "function-call": {
79+ "name": "entity.name.function.htmlang",
80+ "match": "@[a-zA-Z_][a-zA-Z0-9_-]*"
81+ },
82+ "variable": {
83+ "name": "variable.other.htmlang",
84+ "match": "\\$[a-zA-Z_][a-zA-Z0-9_-]*"
85+ },
86+ "attributes": {
87+ "name": "meta.attribute-list.htmlang",
88+ "begin": "\\[",
89+ "end": "\\]",
90+ "beginCaptures": {
91+ "0": { "name": "punctuation.section.brackets.begin.htmlang" }
92+ },
93+ "endCaptures": {
94+ "0": { "name": "punctuation.section.brackets.end.htmlang" }
95+ },
96+ "patterns": [
97+ { "include": "#variable" },
98+ { "include": "#color" },
99+ { "include": "#number" },
100+ { "include": "#state-prefix" },
101+ { "include": "#attribute-name" },
102+ {
103+ "name": "punctuation.separator.comma.htmlang",
104+ "match": ","
105+ }
106+ ]
107+ },
108+ "state-prefix": {
109+ "name": "keyword.other.state.htmlang",
110+ "match": "(?:hover|active|focus):"
111+ },
112+ "attribute-name": {
113+ "name": "support.type.property-name.htmlang",
114+ "match": "\\b(?:spacing|padding|padding-x|padding-y|width|height|min-width|max-width|min-height|max-height|center-x|center-y|align-left|align-right|align-top|align-bottom|background|color|border|rounded|bold|italic|underline|size|font|transition|cursor|opacity|wrap|id|class)\\b"
115+ },
116+ "inline-element": {
117+ "name": "meta.inline-element.htmlang",
118+ "begin": "(\\{)(?=@)",
119+ "end": "(\\})",
120+ "beginCaptures": {
121+ "1": { "name": "punctuation.section.braces.begin.htmlang" }
122+ },
123+ "endCaptures": {
124+ "1": { "name": "punctuation.section.braces.end.htmlang" }
125+ },
126+ "patterns": [
127+ { "include": "#element" },
128+ { "include": "#function-call" },
129+ { "include": "#attributes" },
130+ { "include": "#variable" }
131+ ]
132+ },
133+ "color": {
134+ "name": "constant.other.color.htmlang",
135+ "match": "#[0-9a-fA-F]{3,8}\\b"
136+ },
137+ "number": {
138+ "name": "constant.numeric.htmlang",
139+ "match": "\\b[0-9]+(\\.[0-9]+)?\\b"
140+ }
141+ }
142+}