diff options
Diffstat (limited to 'src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml')
-rw-r--r-- | src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml | 86 |
1 files changed, 83 insertions, 3 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml index 4f9eb962d7..107e1067da 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/html.xml @@ -5,7 +5,7 @@ <!ENTITY attributeName "[A-Za-z_:*#\(\[][\)\]\w.:_-]*"> <!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> ]> -<language name="HTML" version="5" kateversion="3.4" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10"> +<language name="HTML" version="7" kateversion="3.4" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10"> <highlighting> <contexts> @@ -163,16 +163,23 @@ </context> <context name="JS" attribute="Other Text" lineEndContext="#stay"> - <Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="script" /> + <RegExpr attribute="Attribute" context="Script-Type" String="(\s+|^)type(?=\=|\s|$)" insensitive="true"/> <DetectChar attribute="Element" context="JS content" char=">" /> + <IncludeRules context="DefaultJS" /> + </context> + <context name="DefaultJS" attribute="Other Text" lineEndContext="#stay"> + <Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="script" /> <IncludeRules context="FindAttributes" /> <RegExpr attribute="Error" context="#stay" String="\S" /> </context> <context name="JS content" attribute="Other Text" lineEndContext="#stay"> + <IncludeRules context="Default JS content"/> + <IncludeRules context="Normal##JavaScript" includeAttrib="true"/> + </context> + <context name="Default JS content" attribute="Other Text" lineEndContext="#stay"> <RegExpr attribute="Element" context="El Close 2" String="</script\b" insensitive="true" endRegion="script" /> <RegExpr attribute="Comment" context="JS comment close" String="//(?=.*</script\b)" insensitive="true" /> - <IncludeRules context="Normal##JavaScript" includeAttrib="true"/> </context> <context name="JS comment close" attribute="Comment" lineEndContext="#pop"> @@ -202,6 +209,79 @@ <IncludeRules context="FindEntityRefs" /> </context> + <!-- Read content from the "type" attribute to change the language to + highlight in the <script> tag. The default language is JavaScript. --> + + <context name="Script-Type" attribute="Other Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> + <DetectSpaces /> + <DetectChar attribute="Attribute" context="#pop!Script-Type Value" char="=" /> + </context> + <context name="Script-Type Value" attribute="Other Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!Value"> + <DetectSpaces /> + <!-- TypeScript --> + <StringDetect attribute="Value" context="#pop#pop!TypeScript" String=""text/typescript""/> + <StringDetect attribute="Value" context="#pop#pop!TypeScript" String="'text/typescript'"/> + <!-- JSX (JavaScript React) --> + <StringDetect attribute="Value" context="#pop#pop!JSX" String=""text/jsx""/> + <StringDetect attribute="Value" context="#pop#pop!JSX" String="'text/jsx'"/> + <StringDetect attribute="Value" context="#pop#pop!JSX" String=""text/babel""/> + <StringDetect attribute="Value" context="#pop#pop!JSX" String="'text/babel'"/> + <!-- MustacheJS / HandlebarsJS / RactiveJS --> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""x-tmpl-mustache""/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'x-tmpl-mustache'"/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""text/mustache""/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'text/mustache'"/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""text/x-mustache-template""/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'text/x-mustache-template'"/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""text/x-handlebars-template""/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'text/x-handlebars-template'"/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String=""text/ractive""/> + <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="'text/ractive'"/> + <!-- HTML templates --> + <StringDetect attribute="Value" context="#pop#pop!Script HTML template" String=""text/html""/> + <StringDetect attribute="Value" context="#pop#pop!Script HTML template" String="'text/html'"/> + </context> + + <context name="JSX" attribute="Other Text" lineEndContext="#stay"> + <DetectChar attribute="Element" context="JSX content" char=">" /> + <IncludeRules context="DefaultJS" /> + </context> + <context name="JSX content" attribute="Other Text" lineEndContext="#stay"> + <IncludeRules context="Default JS content"/> + <IncludeRules context="Normal##JavaScript React" includeAttrib="true"/> + </context> + + <context name="TypeScript" attribute="Other Text" lineEndContext="#stay"> + <DetectChar attribute="Element" context="TypeScript content" char=">" /> + <IncludeRules context="DefaultJS" /> + </context> + <context name="TypeScript content" attribute="Other Text" lineEndContext="#stay"> + <IncludeRules context="Default JS content"/> + <IncludeRules context="Normal##TypeScript" includeAttrib="true"/> + </context> + + <context name="MustacheJS" attribute="Other Text" lineEndContext="#stay"> + <DetectChar attribute="Element" context="MustacheJS content" char=">" /> + <IncludeRules context="DefaultJS" /> + </context> + <context name="MustacheJS content" attribute="Other Text" lineEndContext="#stay"> + <RegExpr attribute="Element" context="El Close 2" String="</script\b" insensitive="true" endRegion="script" /> + <StringDetect attribute="Error" context="#stay" String="<script>" insensitive="true" /> + <RegExpr attribute="Error" context="#stay" String="<script\b" insensitive="true" /> + <IncludeRules context="Base##Mustache/Handlebars (HTML)" includeAttrib="true"/> + </context> + + <context name="Script HTML template" attribute="Other Text" lineEndContext="#stay"> + <DetectChar attribute="Element" context="Script HTML template content" char=">" /> + <IncludeRules context="DefaultJS" /> + </context> + <context name="Script HTML template content" attribute="Other Text" lineEndContext="#stay"> + <RegExpr attribute="Element" context="El Close 2" String="</script\b" insensitive="true" endRegion="script" /> + <StringDetect attribute="Error" context="#stay" String="<script>" insensitive="true" /> + <RegExpr attribute="Error" context="#stay" String="<script\b" insensitive="true" /> + <IncludeRules context="FindHTML" /> + </context> + </contexts> <itemDatas> <itemData name="Normal Text" defStyleNum="dsNormal" /> |