Warning, /frameworks/syntax-highlighting/data/syntax/mustache.xml is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" encoding="UTF-8"?>
0002 <!DOCTYPE language
0003 [
0004         <!ENTITY name          "[A-Za-z_:][\w.:_-]*">
0005         <!ENTITY attributeName "(?:\s|^)[A-Za-z_:\*#\(\[][\)\]\w\.:_-]*">
0006         <!ENTITY entref        "&amp;(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
0007         <!ENTITY tag           "&lt;\s*(?:&name;|&gt;)">
0008         <!-- Handlebars identifier -->
0009         <!ENTITY identifier    "(?:[a-zA-Z_$:\?]|[^[:ascii:]])(?:[\w$:\?\-]|[^[:ascii:]])*">
0010 ]>
0011 
0012 <!--
0013     Syntax Highlighting Defintion of
0014     Mustache / Handlebars / Ractive templates for Kate.
0015    ================================================================
0016     This file is part of the KDE's KSyntaxHighlighting framework.
0017 
0018     Based on the HTML syntax highlighting file, by Wilbert
0019     Berendsen (wilbert@kde.nl), and in the Mustache syntax files
0020     for Vim, available at:
0021       https://github.com/mustache/vim-mustache-handlebars
0022 
0023     This highlighter is also applicable to the templates of
0024     Ractive.js, Hogan.js and Hulk.js.
0025 
0026     This file is also used within the HTML highlighter,
0027     inside the <script> tags.
0028 
0029     FIXME: The support of Mustache variables in CSS is incomplete,
0030     since variables aren't highlighted in many contexts.
0031     This highlighter doesn't offer support for TypeScript and JSX
0032     in the <script> tag.
0033 
0034     TODO: This code can be generated by a script, in the same way
0035     as the PHP highlight, injecting the "MustacheVariables" context
0036     (via IncludeRules) in the HTML highlighter.
0037 
0038     Change log:
0039      * v5 [2020-08-15]: Use Handlebars comment en the <comments> group.
0040      * v3 [2019-10-03]: Minor fixes.
0041      * v2 [2019-02-24]: Also highlight template files (HTML).
0042                         Improve support for Handlebars.
0043      * v1 [2019-02-10]: Initial version
0044 -->
0045 
0046 <language name="Mustache/Handlebars (HTML)" version="8" kateversion="5.53"
0047           section="Markup" priority="1" mimetype=""
0048           extensions="*.mustache;*.handlebars;*.hbs;*.ractive;*.hogan;*.hulk;*.html.mst;*.html.mu;*.html.rac"
0049           author="Nibaldo González (nibgonz@gmail.com), based on the HTML highlighter by Wilbert Berendsen (wilbert@kde.nl)"
0050           license="MIT">
0051 
0052 <highlighting>
0053 
0054         <contexts>
0055 
0056                 <context name="Normal" attribute="Normal Text" lineEndContext="#stay">
0057                         <RegExpr context="CSS" attribute="Element Tag" String="&lt;style\b" insensitive="true" beginRegion="style" />
0058                         <RegExpr context="JS" attribute="Element Tag" String="&lt;script\b" insensitive="true" beginRegion="script" />
0059                         <IncludeRules context="Base" />
0060                 </context>
0061 
0062                 <!-- NOTE: Include this context within the <script> tag in the HTML highlighter -->
0063                 <context name="Base" attribute="Normal Text" lineEndContext="#stay">
0064                         <IncludeRules context="MustacheVariables" />
0065 
0066                         <StringDetect context="CDATA" attribute="CDATA" String="&lt;![CDATA[" beginRegion="cdata" />
0067                         <RegExpr context="Doctype" attribute="Doctype" String="&lt;!DOCTYPE\s+" insensitive="true" beginRegion="doctype"  />
0068                         <IncludeRules context="FindPI" />
0069 
0070                         <IncludeRules context="FindTags" />
0071                         <IncludeRules context="FindElementTagEnd" />
0072                         <IncludeRules context="FindComments" />
0073                         <IncludeRules context="FindDTDRules" />
0074                         <IncludeRules context="FindEntityRefs" />
0075                 </context>
0076 
0077                 <!-- Mustache/Handlebars Variables -->
0078 
0079                 <context name="MustacheVariables" attribute="Normal Text" lineEndContext="#stay">
0080                         <StringDetect context="#stay" attribute="Normal Text" String="\{{" />
0081                         <Detect2Chars context="StartMustacheVariable" char="{" char1="{" lookAhead="true" />
0082                 </context>
0083                 <context name="StartMustacheVariable" attribute="Normal Text" lineEndContext="#stay">
0084                         <!-- Escaped -->
0085                         <RegExpr context="#pop!MustacheRawBlockContent" attribute="Mustache Block" String="\{{4}[^/].*\}{4}" minimal="true" beginRegion="HandlebarsRawBlock" />
0086                         <!-- Sections -->
0087                         <!-- For helpers (not included because it's redundant):
0088                                Start: \{\{~?#?\s*(?=(?:if|unless|with|link\-to|each(?:\-in)?)\b)
0089                                End:   \{\{~?/\s*(?=(?:if|unless|with|link\-to|each(?:\-in)?)\b)  -->
0090                         <RegExpr context="#pop!MustacheVariableBlock" attribute="Mustache Block" String="\{\{~?\s*else(?:\s+(?:if|unless|with|link\-to|each(?:\-in)?))?\b" />
0091                         <RegExpr context="#pop!MustacheVariableBlock" attribute="Mustache Block" String="\{\{~?[#\^][&gt;\*]?\s*&identifier;\b" beginRegion="MustacheBlock" />
0092                         <RegExpr context="#pop" attribute="Mustache Block" String="\{\{~?/\s*&identifier;\s*\}\}" endRegion="MustacheBlock" />
0093                         <RegExpr context="#pop!MustacheVariableBlockEndFolding" attribute="Mustache Block" String="\{\{~?/\s*&identifier;\b" />
0094                         <RegExpr context="#pop!MustacheVariableBlock" attribute="Mustache Block" String="\{\{~?[#\^/]" />
0095                         <!-- Comments -->
0096                         <StringDetect context="#pop!HandlebarsInlineComment" attribute="Comment" String="{{!--" beginRegion="HandlebarsInlineComment" /> <!-- Handlebars -->
0097                         <StringDetect context="#pop!MustacheInlineComment" attribute="Comment" String="{{!" beginRegion="MustacheInlineComment" />
0098                         <!-- Variables -->
0099                         <StringDetect context="#pop!MustachePartial" attribute="Mustache Variable" String="{{&lt;" />
0100                         <StringDetect context="#pop!MustachePartial" attribute="Mustache Variable" String="{{&gt;" />
0101                         <StringDetect context="#pop!MustacheMarkerSet" attribute="Mustache Variable" String="{{=" />
0102                         <StringDetect context="#pop!MustacheVariable" attribute="Mustache Variable" String="{{$" />
0103                         <RegExpr context="#pop!MustacheVariableUnescape" attribute="Mustache Variable Unescape" String="\{\{\{\s*(?:log|link)\b" />
0104                         <RegExpr context="#pop!MustacheVariable" attribute="Mustache Variable" String="\{\{\s*(?:log|link)\b" />
0105 
0106                         <StringDetect context="#pop!MustacheVariableUnescape" attribute="Mustache Variable Unescape" String="{{{" />
0107                         <Detect2Chars context="#pop!MustacheVariable" attribute="Mustache Variable" char="{" char1="{" />
0108                 </context>
0109 
0110                 <context name="MustacheRawBlockContent" attribute="Normal Text" lineEndContext="#stay">
0111                         <RegExpr context="#pop" attribute="Mustache Block" String="\{{4}/.*\}{4}" minimal="true" endRegion="HandlebarsRawBlock" />
0112                 </context>
0113 
0114                 <context name="MustachePartial" attribute="Mustache Partial" lineEndContext="#stay">
0115                         <Detect2Chars context="#pop" attribute="Mustache Variable" char="}" char1="}" />
0116                         <IncludeRules context="MustacheInside" />
0117                 </context>
0118                 <context name="MustacheMarkerSet" attribute="Mustache Marker Set" lineEndContext="#stay">
0119                         <StringDetect context="#pop" attribute="Mustache Variable" String="=}}" />
0120                 </context>
0121 
0122                 <context name="MustacheVariableBlock" attribute="Mustache Inside" lineEndContext="#stay">
0123                         <Detect2Chars context="#pop" attribute="Mustache Block" char="}" char1="}" />
0124                         <IncludeRules context="MustacheInside" />
0125                 </context>
0126                 <context name="MustacheVariableBlockEndFolding" attribute="Mustache Inside" lineEndContext="#stay">
0127                         <Detect2Chars context="#pop" attribute="Mustache Block" char="}" char1="}" endRegion="MustacheBlock" />
0128                         <IncludeRules context="MustacheInside" />
0129                 </context>
0130                 <context name="MustacheVariable" attribute="Mustache Inside" lineEndContext="#stay">
0131                         <Detect2Chars context="#pop" attribute="Mustache Variable" char="}" char1="}" />
0132                         <IncludeRules context="MustacheInside" />
0133                 </context>
0134                 <context name="MustacheVariableUnescape" attribute="Mustache Inside" lineEndContext="#stay">
0135                         <StringDetect context="#pop" attribute="Mustache Variable Unescape" String="}}}" />
0136                         <IncludeRules context="MustacheInside" />
0137                 </context>
0138 
0139                 <!-- Within the variable -->
0140                 <context name="MustacheInside" attribute="Mustache Inside" lineEndContext="#pop">
0141                         <DetectChar context="MustacheStringDQ" attribute="String" char="&quot;" />
0142                         <DetectChar context="MustacheStringSQ" attribute="String" char="&apos;" />
0143                         <AnyChar context="#stay" attribute="Symbol" String=".[]|" />
0144                         <RegExpr context="MustacheSymbolValue" attribute="Attribute" String="&attributeName;(?=\s*\=)" />
0145                 </context>
0146                 <context name="MustacheStringDQ" attribute="String" lineEndContext="#pop">
0147                         <DetectChar context="#pop" attribute="String" char="&quot;" />
0148                         <LineContinue context="#stay" attribute="Escape" />
0149                         <HlCStringChar context="#stay" attribute="Escape" />
0150                 </context>
0151                 <context name="MustacheStringSQ" attribute="String" lineEndContext="#pop">
0152                         <DetectChar context="#pop" attribute="String" char="&apos;" />
0153                         <LineContinue context="#stay" attribute="Escape" />
0154                         <HlCStringChar context="#stay" attribute="Escape" />
0155                 </context>
0156                 <context name="MustacheSymbolValue" attribute="Mustache Inside" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
0157                         <DetectChar context="#pop!MustacheValue" attribute="Symbol" char="=" />
0158                         <DetectSpaces />
0159                 </context>
0160                 <context name="MustacheValue" attribute="Mustache Inside" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
0161                         <DetectSpaces />
0162                         <RegExpr context="#pop" attribute="Number" String="\d+(?=[\s\}\)\]]|$)" />
0163                 </context>
0164 
0165                 <context name="HandlebarsInlineComment" attribute="Comment" lineEndContext="#stay">
0166                         <StringDetect context="#pop" attribute="Comment" String="--}}" endRegion="HandlebarsInlineComment" />
0167                         <DetectSpaces />
0168                         <IncludeRules context="##Comments" />
0169                 </context>
0170                 <context name="MustacheInlineComment" attribute="Comment" lineEndContext="#stay">
0171                         <Detect2Chars context="#pop" attribute="Comment" char="}" char1="}" endRegion="MustacheInlineComment" />
0172                         <DetectSpaces />
0173                         <IncludeRules context="##Comments" />
0174                 </context>
0175 
0176                 <!-- Tags -->
0177 
0178                 <!-- Start tag -->
0179                 <context name="FindTags" attribute="Normal Text" lineEndContext="#stay">
0180                         <!-- Common HTML tags (obtained from 'html.xml') -->
0181                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;pre" insensitive="true" beginRegion="pre" />
0182                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;div" insensitive="true" beginRegion="div" />
0183                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;table" insensitive="true" beginRegion="table" />
0184                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;ul" insensitive="true" beginRegion="ul" />
0185                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;ol" insensitive="true" beginRegion="ol" />
0186                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;dl" insensitive="true" beginRegion="dl" />
0187                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;article" insensitive="true" beginRegion="article" />
0188                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;aside" insensitive="true" beginRegion="aside" />
0189                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;details" insensitive="true" beginRegion="details" />
0190                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;figure" insensitive="true" beginRegion="figure" />
0191                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;footer" insensitive="true" beginRegion="footer" />
0192                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;header" insensitive="true" beginRegion="header" />
0193                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;main" insensitive="true" beginRegion="main" />
0194                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;nav" insensitive="true" beginRegion="nav" />
0195                         <WordDetect context="ElementTag" attribute="Element Tag" String="&lt;section" insensitive="true" beginRegion="section" />
0196 
0197                         <RegExpr context="#stay" attribute="Element Tag" String="&lt;\s*&gt;" />
0198                         <RegExpr context="ElementTag" attribute="Element Tag" String="&tag;" />
0199                 </context>
0200                 <context name="FindEntityRefs" attribute="Normal Text" lineEndContext="#stay">
0201                         <RegExpr context="#stay" attribute="EntityRef" String="&entref;" />
0202                 </context>
0203 
0204                 <!-- Tag end: </tag> -->
0205                 <context name="FindElementTagEnd" attribute="Normal Text" lineEndContext="#stay">
0206                         <!-- Common HTML tags (obtained from 'html.xml') -->
0207                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/pre" insensitive="true" endRegion="pre" />
0208                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/div" insensitive="true" endRegion="div" />
0209                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/table" insensitive="true" endRegion="table" />
0210                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/ul" insensitive="true" endRegion="ul" />
0211                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/ol" insensitive="true" endRegion="ol" />
0212                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/dl" insensitive="true" endRegion="dl" />
0213                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/article" insensitive="true" endRegion="article" />
0214                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/aside" insensitive="true" endRegion="aside" />
0215                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/details" insensitive="true" endRegion="details" />
0216                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/figure" insensitive="true" endRegion="figure" />
0217                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/footer" insensitive="true" endRegion="footer" />
0218                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/header" insensitive="true" endRegion="header" />
0219                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/main" insensitive="true" endRegion="main" />
0220                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/nav" insensitive="true" endRegion="nav" />
0221                         <WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/section" insensitive="true" endRegion="section" />
0222 
0223                         <RegExpr context="#stay" attribute="Element Tag" String="&lt;/\s*&gt;" />
0224                         <RegExpr context="ElementTagEnd" attribute="Element Tag" String="&lt;/\s*&name;" />
0225                 </context>
0226                 <context name="ElementTagEnd" attribute="Normal Text" lineEndContext="#stay">
0227                         <DetectChar context="#pop" attribute="Element Tag" char="&gt;" />
0228                         <IncludeRules context="MustacheVariables" />
0229                         <RegExpr context="#stay" attribute="Error" String="\S" />
0230                 </context>
0231 
0232                 <!-- Inside the tag -->
0233                 <context name="ElementTag" attribute="Normal Text" lineEndContext="#stay">
0234                         <Detect2Chars context="#pop" attribute="Element Tag" char="/" char1="&gt;" />
0235                         <DetectChar context="#pop" attribute="Element Tag" char="&gt;" />
0236                         <IncludeRules context="MustacheVariables" />
0237                         <IncludeRules context="FindAttributes" />
0238                         <RegExpr context="#stay" attribute="Error" String="\S" />
0239                 </context>
0240                 <context name="FindAttributes" attribute="Normal Text" lineEndContext="#stay">
0241                         <RegExpr context="#stay" attribute="Attribute" String="&attributeName;" />
0242                         <RegExpr context="#stay" attribute="Error" String="\=(?=\s*/?&gt;)" />
0243                         <DetectChar context="Value" attribute="Symbol" char="=" />
0244                 </context>
0245 
0246                 <context name="Value" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!ValueNQ">
0247                         <DetectChar context="#pop!ValueDQ" attribute="Value" char="&quot;" />
0248                         <DetectChar context="#pop!ValueSQ" attribute="Value" char="&apos;" />
0249                         <RegExpr context="#pop" attribute="Number" String="\d+(?=\s|/?&gt;|$)" />
0250                         <DetectSpaces />
0251                 </context>
0252                 <context name="ValueDQ" attribute="Value" lineEndContext="#stay">
0253                         <DetectChar context="#pop" attribute="Value" char="&quot;" />
0254                         <IncludeRules context="MustacheVariables" />
0255                         <IncludeRules context="FindEntityRefs" />
0256                 </context>
0257                 <context name="ValueSQ" attribute="Value" lineEndContext="#stay">
0258                         <DetectChar context="#pop" attribute="Value" char="&apos;" />
0259                         <IncludeRules context="MustacheVariables" />
0260                         <IncludeRules context="FindEntityRefs" />
0261                 </context>
0262                 <context name="ValueNQ" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
0263                         <IncludeRules context="MustacheVariables" />
0264                         <IncludeRules context="FindEntityRefs" />
0265                         <RegExpr context="#stay" attribute="Value" String="/(?!&gt;)|[^/&gt;&lt;&quot;&apos;\s]" />
0266                 </context>
0267 
0268                 <!-- HTML -->
0269                 <!-- NOTE: This contexts are duplicated from 'html.xml', adding the Mustache variables -->
0270 
0271                 <context name="FindComments" attribute="Normal Text" lineEndContext="#stay">
0272                         <StringDetect context="Comment" attribute="Comment" String="&lt;!--" beginRegion="Comment" />
0273                 </context>
0274                 <context name="Comment" attribute="Comment" lineEndContext="#stay">
0275                         <DetectSpaces/>
0276                         <StringDetect context="#pop" attribute="Comment" String="--&gt;" endRegion="Comment" />
0277                         <RegExpr context="#stay" attribute="Error" String="-(?:-(?!-&gt;))+" />
0278                         <IncludeRules context="MustacheVariables" />
0279                         <IncludeRules context="##Comments" />
0280                 </context>
0281 
0282                 <context name="FindPEntityRefs" attribute="Normal Text" lineEndContext="#stay">
0283                         <RegExpr attribute="EntityRef" context="#stay" String="&entref;" />
0284                         <RegExpr attribute="PEntityRef" context="#stay" String="%&name;;" />
0285                         <AnyChar attribute="Error" context="#stay" String="&amp;%" />
0286                 </context>
0287 
0288                 <context name="FindDTDRules" attribute="Normal Text" lineEndContext="#stay">
0289                         <RegExpr context="Doctype Markupdecl" attribute="Doctype" String="&lt;!(?:ELEMENT|ENTITY|ATTLIST|NOTATION)\b" />
0290                 </context>
0291                 <context name="FindPI" attribute="Normal Text" lineEndContext="#stay">
0292                         <RegExpr context="PI" attribute="Processing Instruction" String="&lt;\?[\w:-]*" beginRegion="pi" />
0293                 </context>
0294 
0295                 <context name="CDATA" attribute="Normal Text" lineEndContext="#stay">
0296                         <IncludeRules context="MustacheVariables" />
0297                         <StringDetect context="#pop" attribute="CDATA" String="]]&gt;" endRegion="cdata" />
0298                         <StringDetect context="#stay" attribute="EntityRef" String="]]&amp;gt;" />
0299                 </context>
0300 
0301                 <context name="PI" attribute="Normal Text" lineEndContext="#stay">
0302                         <IncludeRules context="MustacheVariables" />
0303                         <Detect2Chars context="#pop" attribute="Processing Instruction" char="?" char1="&gt;" endRegion="pi" />
0304                 </context>
0305 
0306                 <context name="Doctype" attribute="Normal Text" lineEndContext="#stay">
0307                         <IncludeRules context="MustacheVariables" />
0308                         <DetectChar context="#pop" attribute="Doctype" char="&gt;" endRegion="doctype" />
0309                         <DetectChar context="Doctype Internal Subset" attribute="Doctype" char="[" beginRegion="int_subset" />
0310                 </context>
0311                 <context name="Doctype Internal Subset" attribute="Normal Text" lineEndContext="#stay">
0312                         <DetectChar context="#pop" attribute="Doctype" char="]" endRegion="int_subset" />
0313                         <IncludeRules context="MustacheVariables" />
0314                         <IncludeRules context="FindDTDRules" />
0315                         <IncludeRules context="FindComments" />
0316                         <IncludeRules context="FindPI" />
0317                         <IncludeRules context="FindPEntityRefs" />
0318                 </context>
0319                 <context name="Doctype Markupdecl" attribute="Normal Text" lineEndContext="#stay">
0320                         <DetectChar attribute="Doctype" context="#pop" char="&gt;" />
0321                         <IncludeRules context="MustacheVariables" />
0322                         <DetectChar attribute="Value" context="Doctype Markupdecl DQ" char="&quot;" />
0323                         <DetectChar attribute="Value" context="Doctype Markupdecl SQ" char="&apos;" />
0324                 </context>
0325                 <context name="Doctype Markupdecl DQ" attribute="Value" lineEndContext="#stay">
0326                         <DetectChar attribute="Value" context="#pop" char="&quot;" />
0327                         <IncludeRules context="MustacheVariables" />
0328                         <IncludeRules context="FindPEntityRefs" />
0329                 </context>
0330                 <context name="Doctype Markupdecl SQ" attribute="Value" lineEndContext="#stay">
0331                         <DetectChar attribute="Value" context="#pop" char="&apos;" />
0332                         <IncludeRules context="MustacheVariables" />
0333                         <IncludeRules context="FindPEntityRefs" />
0334                 </context>
0335 
0336                 <!-- CSS -->
0337 
0338                 <context name="CSS" attribute="Normal Text" lineEndContext="#stay">
0339                         <Detect2Chars context="#pop" attribute="Element Tag" char="/" char1="&gt;" endRegion="style" />
0340                         <DetectChar context="#pop!CSSContent" attribute="Element Tag" char="&gt;" />
0341                         <IncludeRules context="MustacheVariables" />
0342                         <IncludeRules context="FindAttributes" />
0343                         <RegExpr context="#stay" attribute="Error" String="\S" />
0344                 </context>
0345                 <context name="CSSContent" attribute="Normal Text" lineEndContext="#stay">
0346                         <RegExpr context="#pop!ElementTagEnd" attribute="Element Tag" String="&lt;/style\b" insensitive="true" endRegion="style" />
0347                         <IncludeRules context="MustacheVariables" />
0348 
0349                         <DetectChar context="CSS-RuleSet" attribute="Normal Text" char="{" beginRegion="ruleset" />
0350                         <DetectChar context="CSS-SelectorAttr" attribute="CSS: Selector Attribute" char="[" />
0351                         <IncludeRules context="##CSS" includeAttrib="true"/>
0352                 </context>
0353 
0354                 <!-- Overwrite some rules of 'css.xml' to add Mustache variables -->
0355                 <context name="CSS-RuleSet" attribute="Normal Text" lineEndContext="#stay">
0356                         <DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="ruleset" />
0357                         <IncludeRules context="MustacheVariables" />
0358                         <IncludeRules context="RuleSet##CSS" />
0359                 </context>
0360                 <context name="CSS-SelectorAttr" attribute="CSS: Selector Attribute" lineEndContext="#stay">
0361                         <DetectChar context="#pop" attribute="CSS: Selector Attribute" char="]" />
0362                         <IncludeRules context="MustacheVariables" />
0363                         <IncludeRules context="SelectorAttr##CSS" />
0364                 </context>
0365 
0366                 <!-- JavaScript -->
0367 
0368                 <context name="JS" attribute="Normal Text" lineEndContext="#stay">
0369                         <DetectChar context="#pop!JSContent" attribute="Element Tag" char="&gt;" />
0370                         <Detect2Chars context="#pop" attribute="Element Tag" char="/" char1="&gt;" endRegion="script" />
0371                         <IncludeRules context="MustacheVariables" />
0372                         <IncludeRules context="FindAttributes" />
0373                         <RegExpr attribute="Error" context="#stay" String="\S" />
0374                 </context>
0375 
0376                 <context name="JSContent" attribute="Normal Text" lineEndContext="#stay">
0377                         <RegExpr context="#pop!ElementTagEnd" attribute="Element Tag" String="&lt;/script\b" insensitive="true" endRegion="script" />
0378                         <RegExpr context="JSCommentClose" attribute="Comment" String="//(?=.*&lt;/script\b)" insensitive="true" />
0379                         <IncludeRules context="MustacheVariables" />
0380                         <IncludeRules context="OverwriteJavaScript" />
0381                         <IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
0382                 </context>
0383                 <context name="JSCommentClose" attribute="Comment" lineEndContext="#pop">
0384                         <RegExpr context="#pop#pop!ElementTagEnd" attribute="Element Tag" String="&lt;/script\b" insensitive="true" endRegion="script" />
0385                         <DetectSpaces />
0386                         <IncludeRules context="##Comments" />
0387                 </context>
0388 
0389                 <!-- Overwrite some rules of 'javascript.xml' to add Mustache variables -->
0390                 <context name="OverwriteJavaScript" attribute="Normal Text" lineEndContext="#stay">
0391                         <DetectChar context="JavaScript-Template" attribute="JS: Template" char="`" />
0392                         <StringDetect context="JavaScript-RawTemplate" attribute="JS: Template" String="String.raw`" />
0393                         <DetectChar context="JavaScript-String" attribute="String" char="&quot;" />
0394                         <DetectChar context="JavaScript-StringSQ" attribute="String" char="'" />
0395                         <DetectChar context="JavaScript-Object" attribute="Symbol" char="{" beginRegion="Brace" />
0396                         <DetectChar context="#stay" attribute="Symbol" char="?" />
0397                 </context>
0398                 <context name="JavaScript-Object" attribute="Normal Text" lineEndContext="#stay">
0399                         <DetectChar context="#pop" attribute="Symbol" char="}" endRegion="Brace" />
0400                         <IncludeRules context="MustacheVariables" />
0401                         <IncludeRules context="OverwriteJavaScript" />
0402                         <IncludeRules context="Object##JavaScript" includeAttrib="true" />
0403                 </context>
0404                 <context name="JavaScript-Template" attribute="JS: Template" lineEndContext="#stay">
0405                         <DetectChar context="#pop" attribute="JS: Template" char="`" />
0406                         <Detect2Chars context="JavaScript-Substitution" attribute="JS: Substitution" char="$" char1="{" />
0407                         <IncludeRules context="MustacheVariables" />
0408                         <IncludeRules context="Template##JavaScript" />
0409                 </context>
0410                 <context name="JavaScript-Substitution" attribute="Normal Text" lineEndContext="#stay">
0411                         <DetectChar context="#pop" attribute="JS: Substitution" char="}" />
0412                         <IncludeRules context="MustacheVariables" />
0413                         <IncludeRules context="OverwriteJavaScript" />
0414                         <IncludeRules context="Substitution##JavaScript" />
0415                 </context>
0416                 <context name="JavaScript-String" attribute="String" lineEndContext="#pop">
0417                         <DetectChar context="#pop" attribute="String" char="&quot;" />
0418                         <IncludeRules context="MustacheVariables" />
0419                         <IncludeRules context="String##JavaScript" />
0420                 </context>
0421                 <context name="JavaScript-StringSQ" attribute="String" lineEndContext="#pop">
0422                         <DetectChar context="#pop" attribute="String" char="'" />
0423                         <IncludeRules context="MustacheVariables" />
0424                         <IncludeRules context="String SQ##JavaScript" />
0425                 </context>
0426                 <context name="JavaScript-RawTemplate" attribute="JS: Template" lineEndContext="#stay">
0427                         <DetectChar context="#pop" attribute="JS: Template" char="`" />
0428                         <IncludeRules context="MustacheVariables" />
0429                 </context>
0430 
0431         </contexts>
0432 
0433         <itemDatas>
0434                 <itemData name="Normal Text"       defStyleNum="dsNormal" spellChecking="false" />
0435                 <itemData name="Comment"           defStyleNum="dsComment" />
0436 
0437                 <itemData name="Mustache Inside"   defStyleNum="dsNormal" spellChecking="false" />
0438                 <itemData name="Mustache Block"    defStyleNum="dsFunction" bold="1" spellChecking="false" />
0439                 <itemData name="Mustache Variable" defStyleNum="dsVariable" spellChecking="false" />
0440                 <itemData name="Mustache Variable Unescape" defStyleNum="dsSpecialChar" spellChecking="false" />
0441                 <itemData name="Mustache Partial"  defStyleNum="dsChar" spellChecking="false" />
0442                 <itemData name="Mustache Marker Set" defStyleNum="dsVariable" spellChecking="false" />
0443                 <itemData name="String"            defStyleNum="dsString" />
0444                 <itemData name="Number"            defStyleNum="dsDecVal" />
0445 
0446                 <itemData name="Element Tag"       defStyleNum="dsKeyword" spellChecking="false" />
0447                 <itemData name="Attribute"         defStyleNum="dsOthers" spellChecking="false" />
0448                 <itemData name="Value"             defStyleNum="dsString" spellChecking="false" />
0449                 <itemData name="Symbol"            defStyleNum="dsOperator" />
0450                 <itemData name="Escape"            defStyleNum="dsSpecialChar" />
0451                 <itemData name="Error"             defStyleNum="dsError" spellChecking="false" />
0452 
0453                 <itemData name="EntityRef"         defStyleNum="dsDecVal" spellChecking="false" />
0454                 <itemData name="PEntityRef"        defStyleNum="dsDecVal" spellChecking="false" />
0455                 <itemData name="CDATA"             defStyleNum="dsBaseN" bold="1" spellChecking="false" />
0456                 <itemData name="Processing Instruction" defStyleNum="dsKeyword" spellChecking="false" />
0457                 <itemData name="Doctype"           defStyleNum="dsDataType" bold="1" spellChecking="false" />
0458 
0459                 <!-- CSS itemDatas -->
0460                 <itemData name="CSS: Selector Attribute" defStyleNum="dsExtension" spellChecking="false"/>
0461                 <!-- JavaScript itemDatas -->
0462                 <itemData name="JS: Template"     defStyleNum="dsVerbatimString" />
0463                 <itemData name="JS: Substitution" defStyleNum="dsSpecialChar" spellChecking="false" />
0464         </itemDatas>
0465 
0466 </highlighting>
0467 
0468 <general>
0469         <comments>
0470                 <comment name="multiLine" start="{{!--" end="--}}" region="HandlebarsInlineComment" />
0471         </comments>
0472 </general>
0473 
0474 </language>
0475 <!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; dynamic-word-wrap off; -->