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