<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
	<!ENTITY name          "[A-Za-z_:][\w.:_-]*">
	<!ENTITY attributeName "(?:\s|^)[A-Za-z_:\*#\(\[][\)\]\w\.:_-]*">
	<!ENTITY entref        "&amp;(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
	<!ENTITY tag           "&lt;\s*(?:&name;|&gt;)">
	<!-- 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="5" kateversion="5.44"
          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">
			<RegExpr context="CSS" attribute="Element Tag" String="&lt;style\b" insensitive="true" beginRegion="style" />
			<RegExpr context="JS" attribute="Element Tag" String="&lt;script\b" 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="&lt;![CDATA[" beginRegion="cdata" />
			<RegExpr context="Doctype" attribute="Doctype" String="&lt;!DOCTYPE\s+" 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="\{\{~?[#\^][&gt;\*]?\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="{{&lt;" />
			<StringDetect context="#pop!MustachePartial" attribute="Mustache Variable" String="{{&gt;" />
			<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="&quot;" />
			<DetectChar context="MustacheStringSQ" attribute="String" char="&apos;" />
			<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="&quot;" />
			<LineContinue context="#stay" attribute="Escape" />
			<HlCStringChar context="#stay" attribute="Escape" />
		</context>
		<context name="MustacheStringSQ" attribute="String" lineEndContext="#pop">
			<DetectChar context="#pop" attribute="String" char="&apos;" />
			<LineContinue context="#stay" attribute="Escape" />
			<HlCStringChar context="#stay" attribute="Escape" />
		</context>
		<context name="MustacheSymbolValue" attribute="Mustache Inside" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<DetectChar context="#pop!MustacheValue" attribute="Symbol" char="=" />
			<DetectSpaces />
		</context>
		<context name="MustacheValue" attribute="Mustache Inside" lineEndContext="#pop" fallthrough="true" 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="##Alerts" />
			<IncludeRules context="##Modelines" />
		</context>
		<context name="MustacheInlineComment" attribute="Comment" lineEndContext="#stay">
			<Detect2Chars context="#pop" attribute="Comment" char="}" char1="}" endRegion="MustacheInlineComment" />
			<DetectSpaces />
			<IncludeRules context="##Alerts" />
			<IncludeRules context="##Modelines" />
		</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="&lt;pre" insensitive="true" beginRegion="pre" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;div" insensitive="true" beginRegion="div" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;table" insensitive="true" beginRegion="table" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;ul" insensitive="true" beginRegion="ul" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;ol" insensitive="true" beginRegion="ol" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;dl" insensitive="true" beginRegion="dl" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;article" insensitive="true" beginRegion="article" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;aside" insensitive="true" beginRegion="aside" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;details" insensitive="true" beginRegion="details" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;figure" insensitive="true" beginRegion="figure" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;footer" insensitive="true" beginRegion="footer" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;header" insensitive="true" beginRegion="header" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;main" insensitive="true" beginRegion="main" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;nav" insensitive="true" beginRegion="nav" />
			<WordDetect context="ElementTag" attribute="Element Tag" String="&lt;section" insensitive="true" beginRegion="section" />

			<RegExpr context="#stay" attribute="Element Tag" String="&lt;\s*&gt;" />
			<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="&lt;/pre" insensitive="true" endRegion="pre" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/div" insensitive="true" endRegion="div" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/table" insensitive="true" endRegion="table" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/ul" insensitive="true" endRegion="ul" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/ol" insensitive="true" endRegion="ol" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/dl" insensitive="true" endRegion="dl" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/article" insensitive="true" endRegion="article" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/aside" insensitive="true" endRegion="aside" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/details" insensitive="true" endRegion="details" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/figure" insensitive="true" endRegion="figure" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/footer" insensitive="true" endRegion="footer" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/header" insensitive="true" endRegion="header" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/main" insensitive="true" endRegion="main" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/nav" insensitive="true" endRegion="nav" />
			<WordDetect context="ElementTagEnd" attribute="Element Tag" String="&lt;/section" insensitive="true" endRegion="section" />

			<RegExpr context="#stay" attribute="Element Tag" String="&lt;/\s*&gt;" />
			<RegExpr context="ElementTagEnd" attribute="Element Tag" String="&lt;/\s*&name;" />
		</context>
		<context name="ElementTagEnd" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="#pop" attribute="Element Tag" char="&gt;" />
			<IncludeRules context="MustacheVariables" />
			<RegExpr context="#stay" attribute="Error" String="\S" />
		</context>

		<!-- Inside the tag -->
		<context name="ElementTag" attribute="Normal Text" lineEndContext="#stay">
			<Detect2Chars context="#pop" attribute="Element Tag" char="/" char1="&gt;" />
			<DetectChar context="#pop" attribute="Element Tag" char="&gt;" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="FindAttributes" />
			<RegExpr context="#stay" attribute="Error" String="\S" />
		</context>
		<context name="FindAttributes" attribute="Normal Text" lineEndContext="#stay">
			<RegExpr context="#stay" attribute="Attribute" String="&attributeName;" />
			<RegExpr context="#stay" attribute="Error" String="\=(?=\s*/?&gt;)" />
			<DetectChar context="Value" attribute="Symbol" char="=" />
		</context>

		<context name="Value" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!ValueNQ">
			<DetectChar context="#pop!ValueDQ" attribute="Value" char="&quot;" />
			<DetectChar context="#pop!ValueSQ" attribute="Value" char="&apos;" />
			<RegExpr context="#pop" attribute="Number" String="\d+(?=\s|/?&gt;|$)" />
			<DetectSpaces />
		</context>
		<context name="ValueDQ" attribute="Value" lineEndContext="#stay">
			<DetectChar context="#pop" attribute="Value" char="&quot;" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="FindEntityRefs" />
		</context>
		<context name="ValueSQ" attribute="Value" lineEndContext="#stay">
			<DetectChar context="#pop" attribute="Value" char="&apos;" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="FindEntityRefs" />
		</context>
		<context name="ValueNQ" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="FindEntityRefs" />
			<RegExpr context="#stay" attribute="Value" String="/(?!&gt;)" />
			<RegExpr context="#stay" attribute="Value" String="[^/&gt;&lt;&quot;&apos;\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="&lt;!--" beginRegion="Comment" />
		</context>
		<context name="Comment" attribute="Comment" lineEndContext="#stay">
			<DetectSpaces/>
			<StringDetect context="#pop" attribute="Comment" String="--&gt;" endRegion="Comment" />
			<RegExpr context="#stay" attribute="Error" String="-(?:-(?!-&gt;))+" />
			<IncludeRules context="MustacheVariables" />
			<DetectSpaces />
			<IncludeRules context="##Alerts" />
			<IncludeRules context="##Modelines" />
		</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="&amp;%" />
		</context>

		<context name="FindDTDRules" attribute="Normal Text" lineEndContext="#stay">
			<RegExpr context="Doctype Markupdecl" attribute="Doctype" String="&lt;!(?:ELEMENT|ENTITY|ATTLIST|NOTATION)\b" />
		</context>
		<context name="FindPI" attribute="Normal Text" lineEndContext="#stay">
			<RegExpr context="PI" attribute="Processing Instruction" String="&lt;\?[\w:-]*" beginRegion="pi" />
		</context>

		<context name="CDATA" attribute="Normal Text" lineEndContext="#stay">
			<IncludeRules context="MustacheVariables" />
			<StringDetect context="#pop" attribute="CDATA" String="]]&gt;" endRegion="cdata" />
			<StringDetect context="#stay" attribute="EntityRef" String="]]&amp;gt;" />
		</context>

		<context name="PI" attribute="Normal Text" lineEndContext="#stay">
			<IncludeRules context="MustacheVariables" />
			<Detect2Chars context="#pop" attribute="Processing Instruction" char="?" char1="&gt;" endRegion="pi" />
		</context>

		<context name="Doctype" attribute="Normal Text" lineEndContext="#stay">
			<IncludeRules context="MustacheVariables" />
			<DetectChar context="#pop" attribute="Doctype" char="&gt;" 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="&gt;" />
			<IncludeRules context="MustacheVariables" />
			<DetectChar attribute="Value" context="Doctype Markupdecl DQ" char="&quot;" />
			<DetectChar attribute="Value" context="Doctype Markupdecl SQ" char="&apos;" />
		</context>
		<context name="Doctype Markupdecl DQ" attribute="Value" lineEndContext="#stay">
			<DetectChar attribute="Value" context="#pop" char="&quot;" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="FindPEntityRefs" />
		</context>
		<context name="Doctype Markupdecl SQ" attribute="Value" lineEndContext="#stay">
			<DetectChar attribute="Value" context="#pop" char="&apos;" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="FindPEntityRefs" />
		</context>

		<!-- CSS -->

		<context name="CSS" attribute="Normal Text" lineEndContext="#stay">
			<Detect2Chars context="#pop" attribute="Element Tag" char="/" char1="&gt;" endRegion="style" />
			<DetectChar context="#pop!CSSContent" attribute="Element Tag" char="&gt;" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="FindAttributes" />
			<RegExpr context="#stay" attribute="Error" String="\S" />
		</context>
		<context name="CSSContent" attribute="Normal Text" lineEndContext="#stay">
			<RegExpr context="#pop!ElementTagEnd" attribute="Element Tag" String="&lt;/style\b" 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">
			<DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="ruleset" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="RuleSet##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="Normal Text" lineEndContext="#stay">
			<DetectChar context="#pop!JSContent" attribute="Element Tag" char="&gt;" />
			<Detect2Chars context="#pop" attribute="Element Tag" char="/" char1="&gt;" endRegion="script" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="FindAttributes" />
			<RegExpr attribute="Error" context="#stay" String="\S" />
		</context>

		<context name="JSContent" attribute="Normal Text" lineEndContext="#stay">
			<RegExpr context="#pop!ElementTagEnd" attribute="Element Tag" String="&lt;/script\b" insensitive="true" endRegion="script" />
			<RegExpr context="JSCommentClose" attribute="Comment" String="//(?=.*&lt;/script\b)" insensitive="true" />
			<IncludeRules context="MustacheVariables" />
			<IncludeRules context="OverwriteJavaScript" />
			<IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
		</context>
		<context name="JSCommentClose" attribute="Comment" lineEndContext="#pop">
			<RegExpr context="#pop#pop!ElementTagEnd" attribute="Element Tag" String="&lt;/script\b" insensitive="true" endRegion="script" />
			<DetectSpaces />
			<IncludeRules context="##Alerts" />
		</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="&quot;" />
			<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="&quot;" />
			<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; -->
