| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language |
| 3 |
[ |
| 4 |
<!ENTITY name "[A-Za-z_:][\w.:_-]*"> |
| 5 |
<!ENTITY attributeName "(?:\s|^)[A-Za-z_:\*#\(\[][\)\]\w\.:_-]*"> |
| 6 |
<!ENTITY entref "&(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> |
| 7 |
<!ENTITY tag "<\s*(?:&name;|>)"> |
| 8 |
<!-- Handlebars identifier --> |
| 9 |
<!ENTITY identifier "(?:[a-zA-Z_$:\?]|[^[:ascii:]])(?:[\w$:\?\-]|[^[:ascii:]])*"> |
| 10 |
]> |
| 11 |
|
| 12 |
<!-- |
| 13 |
Syntax Highlighting Defintion of |
| 14 |
Mustache / Handlebars / Ractive templates for Kate. |
| 15 |
================================================================ |
| 16 |
This file is part of the KDE's KSyntaxHighlighting framework. |
| 17 |
|
| 18 |
Based on the HTML syntax highlighting file, by Wilbert |
| 19 |
Berendsen ([email protected]), and in the Mustache syntax files |
| 20 |
for Vim, available at: |
| 21 |
https://github.com/mustache/vim-mustache-handlebars |
| 22 |
|
| 23 |
This highlighter is also applicable to the templates of |
| 24 |
Ractive.js, Hogan.js and Hulk.js. |
| 25 |
|
| 26 |
This file is also used within the HTML highlighter, |
| 27 |
inside the <script> tags. |
| 28 |
|
| 29 |
FIXME: The support of Mustache variables in CSS is incomplete, |
| 30 |
since variables aren't highlighted in many contexts. |
| 31 |
This highlighter doesn't offer support for TypeScript and JSX |
| 32 |
in the <script> tag. |
| 33 |
|
| 34 |
TODO: This code can be generated by a script, in the same way |
| 35 |
as the PHP highlight, injecting the "MustacheVariables" context |
| 36 |
(via IncludeRules) in the HTML highlighter. |
| 37 |
|
| 38 |
Change log: |
| 39 |
* v5 [2020-08-15]: Use Handlebars comment en the <comments> group. |
| 40 |
* v3 [2019-10-03]: Minor fixes. |
| 41 |
* v2 [2019-02-24]: Also highlight template files (HTML). |
| 42 |
Improve support for Handlebars. |
| 43 |
* v1 [2019-02-10]: Initial version |
| 44 |
--> |
| 45 |
|
| 46 |
<language name="Mustache/Handlebars (HTML)" version="8" kateversion="5.53" |
| 47 |
section="Markup" priority="1" mimetype="" |
| 48 |
extensions="*.mustache;*.handlebars;*.hbs;*.ractive;*.hogan;*.hulk;*.html.mst;*.html.mu;*.html.rac" |
| 49 |
author="Nibaldo González ([email protected]), based on the HTML highlighter by Wilbert Berendsen ([email protected])" |
| 50 |
license="MIT"> |
| 51 |
|
| 52 |
<highlighting> |
| 53 |
|
| 54 |
<contexts> |
| 55 |
|
| 56 |
<context name="Normal" attribute="Normal Text" lineEndContext="#stay"> |
| 57 |
<RegExpr context="CSS" attribute="Element Tag" String="<style\b" insensitive="true" beginRegion="style" /> |
| 58 |
<RegExpr context="JS" attribute="Element Tag" String="<script\b" insensitive="true" beginRegion="script" /> |
| 59 |
<IncludeRules context="Base" /> |
| 60 |
</context> |
| 61 |
|
| 62 |
<!-- NOTE: Include this context within the <script> tag in the HTML highlighter --> |
| 63 |
<context name="Base" attribute="Normal Text" lineEndContext="#stay"> |
| 64 |
<IncludeRules context="MustacheVariables" /> |
| 65 |
|
| 66 |
<StringDetect context="CDATA" attribute="CDATA" String="<![CDATA[" beginRegion="cdata" /> |
| 67 |
<RegExpr context="Doctype" attribute="Doctype" String="<!DOCTYPE\s+" insensitive="true" beginRegion="doctype" /> |
| 68 |
<IncludeRules context="FindPI" /> |
| 69 |
|
| 70 |
<IncludeRules context="FindTags" /> |
| 71 |
<IncludeRules context="FindElementTagEnd" /> |
| 72 |
<IncludeRules context="FindComments" /> |
| 73 |
<IncludeRules context="FindDTDRules" /> |
| 74 |
<IncludeRules context="FindEntityRefs" /> |
| 75 |
</context> |
| 76 |
|
| 77 |
<!-- Mustache/Handlebars Variables --> |
| 78 |
|
| 79 |
<context name="MustacheVariables" attribute="Normal Text" lineEndContext="#stay"> |
| 80 |
<StringDetect context="#stay" attribute="Normal Text" String="\{{" /> |
| 81 |
<Detect2Chars context="StartMustacheVariable" char="{" char1="{" lookAhead="true" /> |
| 82 |
</context> |
| 83 |
<context name="StartMustacheVariable" attribute="Normal Text" lineEndContext="#stay"> |
| 84 |
<!-- Escaped --> |
| 85 |
<RegExpr context="#pop!MustacheRawBlockContent" attribute="Mustache Block" String="\{{4}[^/].*\}{4}" minimal="true" beginRegion="HandlebarsRawBlock" /> |
| 86 |
<!-- Sections --> |
| 87 |
<!-- For helpers (not included because it's redundant): |
| 88 |
Start: \{\{~?#?\s*(?=(?:if|unless|with|link\-to|each(?:\-in)?)\b) |
| 89 |
End: \{\{~?/\s*(?=(?:if|unless|with|link\-to|each(?:\-in)?)\b) --> |
| 90 |
<RegExpr context="#pop!MustacheVariableBlock" attribute="Mustache Block" String="\{\{~?\s*else(?:\s+(?:if|unless|with|link\-to|each(?:\-in)?))?\b" /> |
| 91 |
<RegExpr context="#pop!MustacheVariableBlock" attribute="Mustache Block" String="\{\{~?[#\^][>\*]?\s*&identifier;\b" beginRegion="MustacheBlock" /> |
| 92 |
<RegExpr context="#pop" attribute="Mustache Block" String="\{\{~?/\s*&identifier;\s*\}\}" endRegion="MustacheBlock" /> |
| 93 |
<RegExpr context="#pop!MustacheVariableBlockEndFolding" attribute="Mustache Block" String="\{\{~?/\s*&identifier;\b" /> |
| 94 |
<RegExpr context="#pop!MustacheVariableBlock" attribute="Mustache Block" String="\{\{~?[#\^/]" /> |
| 95 |
<!-- Comments --> |
| 96 |
<StringDetect context="#pop!HandlebarsInlineComment" attribute="Comment" String="{{!--" beginRegion="HandlebarsInlineComment" /> <!-- Handlebars --> |
| 97 |
<StringDetect context="#pop!MustacheInlineComment" attribute="Comment" String="{{!" beginRegion="MustacheInlineComment" /> |
| 98 |
<!-- Variables --> |
| 99 |
<StringDetect context="#pop!MustachePartial" attribute="Mustache Variable" String="{{<" /> |
| 100 |
<StringDetect context="#pop!MustachePartial" attribute="Mustache Variable" String="{{>" /> |
| 101 |
<StringDetect context="#pop!MustacheMarkerSet" attribute="Mustache Variable" String="{{=" /> |
| 102 |
<StringDetect context="#pop!MustacheVariable" attribute="Mustache Variable" String="{{$" /> |
| 103 |
<RegExpr context="#pop!MustacheVariableUnescape" attribute="Mustache Variable Unescape" String="\{\{\{\s*(?:log|link)\b" /> |
| 104 |
<RegExpr context="#pop!MustacheVariable" attribute="Mustache Variable" String="\{\{\s*(?:log|link)\b" /> |
| 105 |
|
| 106 |
<StringDetect context="#pop!MustacheVariableUnescape" attribute="Mustache Variable Unescape" String="{{{" /> |
| 107 |
<Detect2Chars context="#pop!MustacheVariable" attribute="Mustache Variable" char="{" char1="{" /> |
| 108 |
</context> |
| 109 |
|
| 110 |
<context name="MustacheRawBlockContent" attribute="Normal Text" lineEndContext="#stay"> |
| 111 |
<RegExpr context="#pop" attribute="Mustache Block" String="\{{4}/.*\}{4}" minimal="true" endRegion="HandlebarsRawBlock" /> |
| 112 |
</context> |
| 113 |
|
| 114 |
<context name="MustachePartial" attribute="Mustache Partial" lineEndContext="#stay"> |
| 115 |
<Detect2Chars context="#pop" attribute="Mustache Variable" char="}" char1="}" /> |
| 116 |
<IncludeRules context="MustacheInside" /> |
| 117 |
</context> |
| 118 |
<context name="MustacheMarkerSet" attribute="Mustache Marker Set" lineEndContext="#stay"> |
| 119 |
<StringDetect context="#pop" attribute="Mustache Variable" String="=}}" /> |
| 120 |
</context> |
| 121 |
|
| 122 |
<context name="MustacheVariableBlock" attribute="Mustache Inside" lineEndContext="#stay"> |
| 123 |
<Detect2Chars context="#pop" attribute="Mustache Block" char="}" char1="}" /> |
| 124 |
<IncludeRules context="MustacheInside" /> |
| 125 |
</context> |
| 126 |
<context name="MustacheVariableBlockEndFolding" attribute="Mustache Inside" lineEndContext="#stay"> |
| 127 |
<Detect2Chars context="#pop" attribute="Mustache Block" char="}" char1="}" endRegion="MustacheBlock" /> |
| 128 |
<IncludeRules context="MustacheInside" /> |
| 129 |
</context> |
| 130 |
<context name="MustacheVariable" attribute="Mustache Inside" lineEndContext="#stay"> |
| 131 |
<Detect2Chars context="#pop" attribute="Mustache Variable" char="}" char1="}" /> |
| 132 |
<IncludeRules context="MustacheInside" /> |
| 133 |
</context> |
| 134 |
<context name="MustacheVariableUnescape" attribute="Mustache Inside" lineEndContext="#stay"> |
| 135 |
<StringDetect context="#pop" attribute="Mustache Variable Unescape" String="}}}" /> |
| 136 |
<IncludeRules context="MustacheInside" /> |
| 137 |
</context> |
| 138 |
|
| 139 |
<!-- Within the variable --> |
| 140 |
<context name="MustacheInside" attribute="Mustache Inside" lineEndContext="#pop"> |
| 141 |
<DetectChar context="MustacheStringDQ" attribute="String" char=""" /> |
| 142 |
<DetectChar context="MustacheStringSQ" attribute="String" char="'" /> |
| 143 |
<AnyChar context="#stay" attribute="Symbol" String=".[]|" /> |
| 144 |
<RegExpr context="MustacheSymbolValue" attribute="Attribute" String="&attributeName;(?=\s*\=)" /> |
| 145 |
</context> |
| 146 |
<context name="MustacheStringDQ" attribute="String" lineEndContext="#pop"> |
| 147 |
<DetectChar context="#pop" attribute="String" char=""" /> |
| 148 |
<LineContinue context="#stay" attribute="Escape" /> |
| 149 |
<HlCStringChar context="#stay" attribute="Escape" /> |
| 150 |
</context> |
| 151 |
<context name="MustacheStringSQ" attribute="String" lineEndContext="#pop"> |
| 152 |
<DetectChar context="#pop" attribute="String" char="'" /> |
| 153 |
<LineContinue context="#stay" attribute="Escape" /> |
| 154 |
<HlCStringChar context="#stay" attribute="Escape" /> |
| 155 |
</context> |
| 156 |
<context name="MustacheSymbolValue" attribute="Mustache Inside" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 157 |
<DetectChar context="#pop!MustacheValue" attribute="Symbol" char="=" /> |
| 158 |
<DetectSpaces /> |
| 159 |
</context> |
| 160 |
<context name="MustacheValue" attribute="Mustache Inside" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 161 |
<DetectSpaces /> |
| 162 |
<RegExpr context="#pop" attribute="Number" String="\d+(?=[\s\}\)\]]|$)" /> |
| 163 |
</context> |
| 164 |
|
| 165 |
<context name="HandlebarsInlineComment" attribute="Comment" lineEndContext="#stay"> |
| 166 |
<StringDetect context="#pop" attribute="Comment" String="--}}" endRegion="HandlebarsInlineComment" /> |
| 167 |
<DetectSpaces /> |
| 168 |
<IncludeRules context="##Comments" /> |
| 169 |
</context> |
| 170 |
<context name="MustacheInlineComment" attribute="Comment" lineEndContext="#stay"> |
| 171 |
<Detect2Chars context="#pop" attribute="Comment" char="}" char1="}" endRegion="MustacheInlineComment" /> |
| 172 |
<DetectSpaces /> |
| 173 |
<IncludeRules context="##Comments" /> |
| 174 |
</context> |
| 175 |
|
| 176 |
<!-- Tags --> |
| 177 |
|
| 178 |
<!-- Start tag --> |
| 179 |
<context name="FindTags" attribute="Normal Text" lineEndContext="#stay"> |
| 180 |
<!-- Common HTML tags (obtained from 'html.xml') --> |
| 181 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<pre" insensitive="true" beginRegion="pre" /> |
| 182 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<div" insensitive="true" beginRegion="div" /> |
| 183 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<table" insensitive="true" beginRegion="table" /> |
| 184 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<ul" insensitive="true" beginRegion="ul" /> |
| 185 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<ol" insensitive="true" beginRegion="ol" /> |
| 186 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<dl" insensitive="true" beginRegion="dl" /> |
| 187 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<article" insensitive="true" beginRegion="article" /> |
| 188 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<aside" insensitive="true" beginRegion="aside" /> |
| 189 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<details" insensitive="true" beginRegion="details" /> |
| 190 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<figure" insensitive="true" beginRegion="figure" /> |
| 191 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<footer" insensitive="true" beginRegion="footer" /> |
| 192 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<header" insensitive="true" beginRegion="header" /> |
| 193 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<main" insensitive="true" beginRegion="main" /> |
| 194 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<nav" insensitive="true" beginRegion="nav" /> |
| 195 |
<WordDetect context="ElementTag" attribute="Element Tag" String="<section" insensitive="true" beginRegion="section" /> |
| 196 |
|
| 197 |
<RegExpr context="#stay" attribute="Element Tag" String="<\s*>" /> |
| 198 |
<RegExpr context="ElementTag" attribute="Element Tag" String="&tag;" /> |
| 199 |
</context> |
| 200 |
<context name="FindEntityRefs" attribute="Normal Text" lineEndContext="#stay"> |
| 201 |
<RegExpr context="#stay" attribute="EntityRef" String="&entref;" /> |
| 202 |
</context> |
| 203 |
|
| 204 |
<!-- Tag end: </tag> --> |
| 205 |
<context name="FindElementTagEnd" attribute="Normal Text" lineEndContext="#stay"> |
| 206 |
<!-- Common HTML tags (obtained from 'html.xml') --> |
| 207 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</pre" insensitive="true" endRegion="pre" /> |
| 208 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</div" insensitive="true" endRegion="div" /> |
| 209 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</table" insensitive="true" endRegion="table" /> |
| 210 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</ul" insensitive="true" endRegion="ul" /> |
| 211 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</ol" insensitive="true" endRegion="ol" /> |
| 212 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</dl" insensitive="true" endRegion="dl" /> |
| 213 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</article" insensitive="true" endRegion="article" /> |
| 214 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</aside" insensitive="true" endRegion="aside" /> |
| 215 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</details" insensitive="true" endRegion="details" /> |
| 216 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</figure" insensitive="true" endRegion="figure" /> |
| 217 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</footer" insensitive="true" endRegion="footer" /> |
| 218 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</header" insensitive="true" endRegion="header" /> |
| 219 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</main" insensitive="true" endRegion="main" /> |
| 220 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</nav" insensitive="true" endRegion="nav" /> |
| 221 |
<WordDetect context="ElementTagEnd" attribute="Element Tag" String="</section" insensitive="true" endRegion="section" /> |
| 222 |
|
| 223 |
<RegExpr context="#stay" attribute="Element Tag" String="</\s*>" /> |
| 224 |
<RegExpr context="ElementTagEnd" attribute="Element Tag" String="</\s*&name;" /> |
| 225 |
</context> |
| 226 |
<context name="ElementTagEnd" attribute="Normal Text" lineEndContext="#stay"> |
| 227 |
<DetectChar context="#pop" attribute="Element Tag" char=">" /> |
| 228 |
<IncludeRules context="MustacheVariables" /> |
| 229 |
<RegExpr context="#stay" attribute="Error" String="\S" /> |
| 230 |
</context> |
| 231 |
|
| 232 |
<!-- Inside the tag --> |
| 233 |
<context name="ElementTag" attribute="Normal Text" lineEndContext="#stay"> |
| 234 |
<Detect2Chars context="#pop" attribute="Element Tag" char="/" char1=">" /> |
| 235 |
<DetectChar context="#pop" attribute="Element Tag" char=">" /> |
| 236 |
<IncludeRules context="MustacheVariables" /> |
| 237 |
<IncludeRules context="FindAttributes" /> |
| 238 |
<RegExpr context="#stay" attribute="Error" String="\S" /> |
| 239 |
</context> |
| 240 |
<context name="FindAttributes" attribute="Normal Text" lineEndContext="#stay"> |
| 241 |
<RegExpr context="#stay" attribute="Attribute" String="&attributeName;" /> |
| 242 |
<RegExpr context="#stay" attribute="Error" String="\=(?=\s*/?>)" /> |
| 243 |
<DetectChar context="Value" attribute="Symbol" char="=" /> |
| 244 |
</context> |
| 245 |
|
| 246 |
<context name="Value" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!ValueNQ"> |
| 247 |
<DetectChar context="#pop!ValueDQ" attribute="Value" char=""" /> |
| 248 |
<DetectChar context="#pop!ValueSQ" attribute="Value" char="'" /> |
| 249 |
<RegExpr context="#pop" attribute="Number" String="\d+(?=\s|/?>|$)" /> |
| 250 |
<DetectSpaces /> |
| 251 |
</context> |
| 252 |
<context name="ValueDQ" attribute="Value" lineEndContext="#stay"> |
| 253 |
<DetectChar context="#pop" attribute="Value" char=""" /> |
| 254 |
<IncludeRules context="MustacheVariables" /> |
| 255 |
<IncludeRules context="FindEntityRefs" /> |
| 256 |
</context> |
| 257 |
<context name="ValueSQ" attribute="Value" lineEndContext="#stay"> |
| 258 |
<DetectChar context="#pop" attribute="Value" char="'" /> |
| 259 |
<IncludeRules context="MustacheVariables" /> |
| 260 |
<IncludeRules context="FindEntityRefs" /> |
| 261 |
</context> |
| 262 |
<context name="ValueNQ" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 263 |
<IncludeRules context="MustacheVariables" /> |
| 264 |
<IncludeRules context="FindEntityRefs" /> |
| 265 |
<RegExpr context="#stay" attribute="Value" String="/(?!>)|[^/><"'\s]" /> |
| 266 |
</context> |
| 267 |
|
| 268 |
<!-- HTML --> |
| 269 |
<!-- NOTE: This contexts are duplicated from 'html.xml', adding the Mustache variables --> |
| 270 |
|
| 271 |
<context name="FindComments" attribute="Normal Text" lineEndContext="#stay"> |
| 272 |
<StringDetect context="Comment" attribute="Comment" String="<!--" beginRegion="Comment" /> |
| 273 |
</context> |
| 274 |
<context name="Comment" attribute="Comment" lineEndContext="#stay"> |
| 275 |
<DetectSpaces/> |
| 276 |
<StringDetect context="#pop" attribute="Comment" String="-->" endRegion="Comment" /> |
| 277 |
<RegExpr context="#stay" attribute="Error" String="-(?:-(?!->))+" /> |
| 278 |
<IncludeRules context="MustacheVariables" /> |
| 279 |
<IncludeRules context="##Comments" /> |
| 280 |
</context> |
| 281 |
|
| 282 |
<context name="FindPEntityRefs" attribute="Normal Text" lineEndContext="#stay"> |
| 283 |
<RegExpr attribute="EntityRef" context="#stay" String="&entref;" /> |
| 284 |
<RegExpr attribute="PEntityRef" context="#stay" String="%&name;;" /> |
| 285 |
<AnyChar attribute="Error" context="#stay" String="&%" /> |
| 286 |
</context> |
| 287 |
|
| 288 |
<context name="FindDTDRules" attribute="Normal Text" lineEndContext="#stay"> |
| 289 |
<RegExpr context="Doctype Markupdecl" attribute="Doctype" String="<!(?:ELEMENT|ENTITY|ATTLIST|NOTATION)\b" /> |
| 290 |
</context> |
| 291 |
<context name="FindPI" attribute="Normal Text" lineEndContext="#stay"> |
| 292 |
<RegExpr context="PI" attribute="Processing Instruction" String="<\?[\w:-]*" beginRegion="pi" /> |
| 293 |
</context> |
| 294 |
|
| 295 |
<context name="CDATA" attribute="Normal Text" lineEndContext="#stay"> |
| 296 |
<IncludeRules context="MustacheVariables" /> |
| 297 |
<StringDetect context="#pop" attribute="CDATA" String="]]>" endRegion="cdata" /> |
| 298 |
<StringDetect context="#stay" attribute="EntityRef" String="]]&gt;" /> |
| 299 |
</context> |
| 300 |
|
| 301 |
<context name="PI" attribute="Normal Text" lineEndContext="#stay"> |
| 302 |
<IncludeRules context="MustacheVariables" /> |
| 303 |
<Detect2Chars context="#pop" attribute="Processing Instruction" char="?" char1=">" endRegion="pi" /> |
| 304 |
</context> |
| 305 |
|
| 306 |
<context name="Doctype" attribute="Normal Text" lineEndContext="#stay"> |
| 307 |
<IncludeRules context="MustacheVariables" /> |
| 308 |
<DetectChar context="#pop" attribute="Doctype" char=">" endRegion="doctype" /> |
| 309 |
<DetectChar context="Doctype Internal Subset" attribute="Doctype" char="[" beginRegion="int_subset" /> |
| 310 |
</context> |
| 311 |
<context name="Doctype Internal Subset" attribute="Normal Text" lineEndContext="#stay"> |
| 312 |
<DetectChar context="#pop" attribute="Doctype" char="]" endRegion="int_subset" /> |
| 313 |
<IncludeRules context="MustacheVariables" /> |
| 314 |
<IncludeRules context="FindDTDRules" /> |
| 315 |
<IncludeRules context="FindComments" /> |
| 316 |
<IncludeRules context="FindPI" /> |
| 317 |
<IncludeRules context="FindPEntityRefs" /> |
| 318 |
</context> |
| 319 |
<context name="Doctype Markupdecl" attribute="Normal Text" lineEndContext="#stay"> |
| 320 |
<DetectChar attribute="Doctype" context="#pop" char=">" /> |
| 321 |
<IncludeRules context="MustacheVariables" /> |
| 322 |
<DetectChar attribute="Value" context="Doctype Markupdecl DQ" char=""" /> |
| 323 |
<DetectChar attribute="Value" context="Doctype Markupdecl SQ" char="'" /> |
| 324 |
</context> |
| 325 |
<context name="Doctype Markupdecl DQ" attribute="Value" lineEndContext="#stay"> |
| 326 |
<DetectChar attribute="Value" context="#pop" char=""" /> |
| 327 |
<IncludeRules context="MustacheVariables" /> |
| 328 |
<IncludeRules context="FindPEntityRefs" /> |
| 329 |
</context> |
| 330 |
<context name="Doctype Markupdecl SQ" attribute="Value" lineEndContext="#stay"> |
| 331 |
<DetectChar attribute="Value" context="#pop" char="'" /> |
| 332 |
<IncludeRules context="MustacheVariables" /> |
| 333 |
<IncludeRules context="FindPEntityRefs" /> |
| 334 |
</context> |
| 335 |
|
| 336 |
<!-- CSS --> |
| 337 |
|
| 338 |
<context name="CSS" attribute="Normal Text" lineEndContext="#stay"> |
| 339 |
<Detect2Chars context="#pop" attribute="Element Tag" char="/" char1=">" endRegion="style" /> |
| 340 |
<DetectChar context="#pop!CSSContent" attribute="Element Tag" char=">" /> |
| 341 |
<IncludeRules context="MustacheVariables" /> |
| 342 |
<IncludeRules context="FindAttributes" /> |
| 343 |
<RegExpr context="#stay" attribute="Error" String="\S" /> |
| 344 |
</context> |
| 345 |
<context name="CSSContent" attribute="Normal Text" lineEndContext="#stay"> |
| 346 |
<RegExpr context="#pop!ElementTagEnd" attribute="Element Tag" String="</style\b" insensitive="true" endRegion="style" /> |
| 347 |
<IncludeRules context="MustacheVariables" /> |
| 348 |
|
| 349 |
<DetectChar context="CSS-RuleSet" attribute="Normal Text" char="{" beginRegion="ruleset" /> |
| 350 |
<DetectChar context="CSS-SelectorAttr" attribute="CSS: Selector Attribute" char="[" /> |
| 351 |
<IncludeRules context="##CSS" includeAttrib="true"/> |
| 352 |
</context> |
| 353 |
|
| 354 |
<!-- Overwrite some rules of 'css.xml' to add Mustache variables --> |
| 355 |
<context name="CSS-RuleSet" attribute="Normal Text" lineEndContext="#stay"> |
| 356 |
<DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="ruleset" /> |
| 357 |
<IncludeRules context="MustacheVariables" /> |
| 358 |
<IncludeRules context="RuleSet##CSS" /> |
| 359 |
</context> |
| 360 |
<context name="CSS-SelectorAttr" attribute="CSS: Selector Attribute" lineEndContext="#stay"> |
| 361 |
<DetectChar context="#pop" attribute="CSS: Selector Attribute" char="]" /> |
| 362 |
<IncludeRules context="MustacheVariables" /> |
| 363 |
<IncludeRules context="SelectorAttr##CSS" /> |
| 364 |
</context> |
| 365 |
|
| 366 |
<!-- JavaScript --> |
| 367 |
|
| 368 |
<context name="JS" attribute="Normal Text" lineEndContext="#stay"> |
| 369 |
<DetectChar context="#pop!JSContent" attribute="Element Tag" char=">" /> |
| 370 |
<Detect2Chars context="#pop" attribute="Element Tag" char="/" char1=">" endRegion="script" /> |
| 371 |
<IncludeRules context="MustacheVariables" /> |
| 372 |
<IncludeRules context="FindAttributes" /> |
| 373 |
<RegExpr attribute="Error" context="#stay" String="\S" /> |
| 374 |
</context> |
| 375 |
|
| 376 |
<context name="JSContent" attribute="Normal Text" lineEndContext="#stay"> |
| 377 |
<RegExpr context="#pop!ElementTagEnd" attribute="Element Tag" String="</script\b" insensitive="true" endRegion="script" /> |
| 378 |
<RegExpr context="JSCommentClose" attribute="Comment" String="//(?=.*</script\b)" insensitive="true" /> |
| 379 |
<IncludeRules context="MustacheVariables" /> |
| 380 |
<IncludeRules context="OverwriteJavaScript" /> |
| 381 |
<IncludeRules context="Normal##JavaScript" includeAttrib="true"/> |
| 382 |
</context> |
| 383 |
<context name="JSCommentClose" attribute="Comment" lineEndContext="#pop"> |
| 384 |
<RegExpr context="#pop#pop!ElementTagEnd" attribute="Element Tag" String="</script\b" insensitive="true" endRegion="script" /> |
| 385 |
<DetectSpaces /> |
| 386 |
<IncludeRules context="##Comments" /> |
| 387 |
</context> |
| 388 |
|
| 389 |
<!-- Overwrite some rules of 'javascript.xml' to add Mustache variables --> |
| 390 |
<context name="OverwriteJavaScript" attribute="Normal Text" lineEndContext="#stay"> |
| 391 |
<DetectChar context="JavaScript-Template" attribute="JS: Template" char="`" /> |
| 392 |
<StringDetect context="JavaScript-RawTemplate" attribute="JS: Template" String="String.raw`" /> |
| 393 |
<DetectChar context="JavaScript-String" attribute="String" char=""" /> |
| 394 |
<DetectChar context="JavaScript-StringSQ" attribute="String" char="'" /> |
| 395 |
<DetectChar context="JavaScript-Object" attribute="Symbol" char="{" beginRegion="Brace" /> |
| 396 |
<DetectChar context="#stay" attribute="Symbol" char="?" /> |
| 397 |
</context> |
| 398 |
<context name="JavaScript-Object" attribute="Normal Text" lineEndContext="#stay"> |
| 399 |
<DetectChar context="#pop" attribute="Symbol" char="}" endRegion="Brace" /> |
| 400 |
<IncludeRules context="MustacheVariables" /> |
| 401 |
<IncludeRules context="OverwriteJavaScript" /> |
| 402 |
<IncludeRules context="Object##JavaScript" includeAttrib="true" /> |
| 403 |
</context> |
| 404 |
<context name="JavaScript-Template" attribute="JS: Template" lineEndContext="#stay"> |
| 405 |
<DetectChar context="#pop" attribute="JS: Template" char="`" /> |
| 406 |
<Detect2Chars context="JavaScript-Substitution" attribute="JS: Substitution" char="$" char1="{" /> |
| 407 |
<IncludeRules context="MustacheVariables" /> |
| 408 |
<IncludeRules context="Template##JavaScript" /> |
| 409 |
</context> |
| 410 |
<context name="JavaScript-Substitution" attribute="Normal Text" lineEndContext="#stay"> |
| 411 |
<DetectChar context="#pop" attribute="JS: Substitution" char="}" /> |
| 412 |
<IncludeRules context="MustacheVariables" /> |
| 413 |
<IncludeRules context="OverwriteJavaScript" /> |
| 414 |
<IncludeRules context="Substitution##JavaScript" /> |
| 415 |
</context> |
| 416 |
<context name="JavaScript-String" attribute="String" lineEndContext="#pop"> |
| 417 |
<DetectChar context="#pop" attribute="String" char=""" /> |
| 418 |
<IncludeRules context="MustacheVariables" /> |
| 419 |
<IncludeRules context="String##JavaScript" /> |
| 420 |
</context> |
| 421 |
<context name="JavaScript-StringSQ" attribute="String" lineEndContext="#pop"> |
| 422 |
<DetectChar context="#pop" attribute="String" char="'" /> |
| 423 |
<IncludeRules context="MustacheVariables" /> |
| 424 |
<IncludeRules context="String SQ##JavaScript" /> |
| 425 |
</context> |
| 426 |
<context name="JavaScript-RawTemplate" attribute="JS: Template" lineEndContext="#stay"> |
| 427 |
<DetectChar context="#pop" attribute="JS: Template" char="`" /> |
| 428 |
<IncludeRules context="MustacheVariables" /> |
| 429 |
</context> |
| 430 |
|
| 431 |
</contexts> |
| 432 |
|
| 433 |
<itemDatas> |
| 434 |
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false" /> |
| 435 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 436 |
|
| 437 |
<itemData name="Mustache Inside" defStyleNum="dsNormal" spellChecking="false" /> |
| 438 |
<itemData name="Mustache Block" defStyleNum="dsFunction" bold="1" spellChecking="false" /> |
| 439 |
<itemData name="Mustache Variable" defStyleNum="dsVariable" spellChecking="false" /> |
| 440 |
<itemData name="Mustache Variable Unescape" defStyleNum="dsSpecialChar" spellChecking="false" /> |
| 441 |
<itemData name="Mustache Partial" defStyleNum="dsChar" spellChecking="false" /> |
| 442 |
<itemData name="Mustache Marker Set" defStyleNum="dsVariable" spellChecking="false" /> |
| 443 |
<itemData name="String" defStyleNum="dsString" /> |
| 444 |
<itemData name="Number" defStyleNum="dsDecVal" /> |
| 445 |
|
| 446 |
<itemData name="Element Tag" defStyleNum="dsKeyword" spellChecking="false" /> |
| 447 |
<itemData name="Attribute" defStyleNum="dsOthers" spellChecking="false" /> |
| 448 |
<itemData name="Value" defStyleNum="dsString" spellChecking="false" /> |
| 449 |
<itemData name="Symbol" defStyleNum="dsOperator" /> |
| 450 |
<itemData name="Escape" defStyleNum="dsSpecialChar" /> |
| 451 |
<itemData name="Error" defStyleNum="dsError" spellChecking="false" /> |
| 452 |
|
| 453 |
<itemData name="EntityRef" defStyleNum="dsDecVal" spellChecking="false" /> |
| 454 |
<itemData name="PEntityRef" defStyleNum="dsDecVal" spellChecking="false" /> |
| 455 |
<itemData name="CDATA" defStyleNum="dsBaseN" bold="1" spellChecking="false" /> |
| 456 |
<itemData name="Processing Instruction" defStyleNum="dsKeyword" spellChecking="false" /> |
| 457 |
<itemData name="Doctype" defStyleNum="dsDataType" bold="1" spellChecking="false" /> |
| 458 |
|
| 459 |
<!-- CSS itemDatas --> |
| 460 |
<itemData name="CSS: Selector Attribute" defStyleNum="dsExtension" spellChecking="false"/> |
| 461 |
<!-- JavaScript itemDatas --> |
| 462 |
<itemData name="JS: Template" defStyleNum="dsVerbatimString" /> |
| 463 |
<itemData name="JS: Substitution" defStyleNum="dsSpecialChar" spellChecking="false" /> |
| 464 |
</itemDatas> |
| 465 |
|
| 466 |
</highlighting> |
| 467 |
|
| 468 |
<general> |
| 469 |
<comments> |
| 470 |
<comment name="multiLine" start="{{!--" end="--}}" region="HandlebarsInlineComment" /> |
| 471 |
</comments> |
| 472 |
</general> |
| 473 |
|
| 474 |
</language> |
| 475 |
<!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; dynamic-word-wrap off; --> |