Debian Codegraph @

data/syntax/html.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language
3 [
4 <!ENTITY name "[A-Za-z_:][\w.:_-]*">
5 <!ENTITY attributeName "[A-Za-z_:*#\(\[][\)\]\w.:_-]*">
6 <!ENTITY entref "&amp;(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
7 ]>
8 <language name="HTML" version="15" kateversion="5.53" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm;*.aspx" mimetype="text/html" author="Wilbert Berendsen ([email protected])" license="LGPL" priority="10">
9
10 <highlighting>
11 <contexts>
12 <context name="Start" attribute="Normal Text" lineEndContext="#stay">
13 <IncludeRules context="FindHTML" />
14 </context>
15
16 <context name="FindHTML" attribute="Normal Text" lineEndContext="#stay">
17 <DetectSpaces/>
18 <DetectIdentifier/>
19 <StringDetect attribute="Comment" context="Comment" String="&lt;!--" beginRegion="comment" />
20 <StringDetect attribute="CDATA" context="CDATA" String="&lt;![CDATA[" beginRegion="cdata" />
21 <RegExpr attribute="Doctype" context="Doctype" String="&lt;!DOCTYPE\s+" insensitive="true" beginRegion="doctype" />
22 <RegExpr attribute="Processing Instruction" context="PI" String="&lt;\?[\w:-]*" beginRegion="pi" />
23 <IncludeRules context="FindSpecialHTMLTags" />
24 <IncludeRules context="FindHTMLTags" />
25 <!-- as long as kde gives DTDs the text/html mimetype--><IncludeRules context="FindDTDRules" />
26 <IncludeRules context="FindEntityRefs" />
27 </context>
28
29 <!-- This allows you to insert HTML tags in other syntax definitions -->
30 <context name="FindSpecialHTMLTags" attribute="Normal Text" lineEndContext="#stay">
31 <RegExpr attribute="Element" context="CSS" String="&lt;style\b" insensitive="true" beginRegion="style" />
32 <RegExpr attribute="Element" context="JS" String="&lt;script\b" insensitive="true" beginRegion="script" />
33 </context>
34
35 <context name="FindHTMLTags" attribute="Normal Text" lineEndContext="#stay">
36 <WordDetect attribute="Element" context="El Open" String="&lt;pre" insensitive="true" beginRegion="pre" />
37 <WordDetect attribute="Element" context="El Open" String="&lt;div" insensitive="true" beginRegion="div" />
38 <WordDetect attribute="Element" context="El Open" String="&lt;table" insensitive="true" beginRegion="table" />
39 <WordDetect attribute="Element" context="El Open" String="&lt;ul" insensitive="true" beginRegion="ul" />
40 <WordDetect attribute="Element" context="El Open" String="&lt;ol" insensitive="true" beginRegion="ol" />
41 <WordDetect attribute="Element" context="El Open" String="&lt;dl" insensitive="true" beginRegion="dl" />
42 <WordDetect attribute="Element" context="El Open" String="&lt;article" insensitive="true" beginRegion="article" />
43 <WordDetect attribute="Element" context="El Open" String="&lt;aside" insensitive="true" beginRegion="aside" />
44 <WordDetect attribute="Element" context="El Open" String="&lt;details" insensitive="true" beginRegion="details" />
45 <WordDetect attribute="Element" context="El Open" String="&lt;figure" insensitive="true" beginRegion="figure" />
46 <WordDetect attribute="Element" context="El Open" String="&lt;footer" insensitive="true" beginRegion="footer" />
47 <WordDetect attribute="Element" context="El Open" String="&lt;header" insensitive="true" beginRegion="header" />
48 <WordDetect attribute="Element" context="El Open" String="&lt;main" insensitive="true" beginRegion="main" />
49 <WordDetect attribute="Element" context="El Open" String="&lt;nav" insensitive="true" beginRegion="nav" />
50 <WordDetect attribute="Element" context="El Open" String="&lt;section" insensitive="true" beginRegion="section" />
51 <RegExpr attribute="Element" context="El Open" String="&lt;&name;" />
52 <WordDetect attribute="Element" context="El Close" String="&lt;/pre" insensitive="true" endRegion="pre" />
53 <WordDetect attribute="Element" context="El Close" String="&lt;/div" insensitive="true" endRegion="div" />
54 <WordDetect attribute="Element" context="El Close" String="&lt;/table" insensitive="true" endRegion="table" />
55 <WordDetect attribute="Element" context="El Close" String="&lt;/ul" insensitive="true" endRegion="ul" />
56 <WordDetect attribute="Element" context="El Close" String="&lt;/ol" insensitive="true" endRegion="ol" />
57 <WordDetect attribute="Element" context="El Close" String="&lt;/dl" insensitive="true" endRegion="dl" />
58 <WordDetect attribute="Element" context="El Close" String="&lt;/article" insensitive="true" endRegion="article" />
59 <WordDetect attribute="Element" context="El Close" String="&lt;/aside" insensitive="true" endRegion="aside" />
60 <WordDetect attribute="Element" context="El Close" String="&lt;/details" insensitive="true" endRegion="details" />
61 <WordDetect attribute="Element" context="El Close" String="&lt;/figure" insensitive="true" endRegion="figure" />
62 <WordDetect attribute="Element" context="El Close" String="&lt;/footer" insensitive="true" endRegion="footer" />
63 <WordDetect attribute="Element" context="El Close" String="&lt;/header" insensitive="true" endRegion="header" />
64 <WordDetect attribute="Element" context="El Close" String="&lt;/main" insensitive="true" endRegion="main" />
65 <WordDetect attribute="Element" context="El Close" String="&lt;/nav" insensitive="true" endRegion="nav" />
66 <WordDetect attribute="Element" context="El Close" String="&lt;/section" insensitive="true" endRegion="section" />
67 <RegExpr attribute="Element" context="El Close" String="&lt;/&name;" />
68 </context>
69
70 <context name="FindEntityRefs" attribute="Other Text" lineEndContext="#stay">
71 <RegExpr attribute="EntityRef" context="#stay" String="&entref;" />
72 <AnyChar attribute="Error" context="#stay" String="&amp;&lt;" />
73 </context>
74
75 <context name="FindPEntityRefs" attribute="Other Text" lineEndContext="#stay">
76 <RegExpr attribute="EntityRef" context="#stay" String="&entref;" />
77 <RegExpr attribute="PEntityRef" context="#stay" String="%&name;;" />
78 <AnyChar attribute="Error" context="#stay" String="&amp;%" />
79 </context>
80
81 <context name="FindAttributes" attribute="Other Text" lineEndContext="#stay">
82 <RegExpr attribute="Attribute" context="#stay" String="^&attributeName;|\s+&attributeName;" />
83 <DetectChar attribute="Attribute" context="Value" char="=" />
84 </context>
85
86 <context name="FindDTDRules" attribute="Other Text" lineEndContext="#stay">
87 <RegExpr attribute="Doctype" context="Doctype Markupdecl" String="&lt;!(?:ELEMENT|ENTITY|ATTLIST|NOTATION)\b" />
88 </context>
89
90
91 <context name="Comment" attribute="Comment" lineEndContext="#stay">
92 <DetectSpaces/>
93 <StringDetect attribute="Comment" context="#pop" String="--&gt;" endRegion="comment" />
94 <IncludeRules context="##Comments" />
95 <DetectIdentifier/>
96 <RegExpr attribute="Error" context="#stay" String="-(?:-(?!-&gt;))+" />
97 </context>
98
99 <context name="CDATA" attribute="Other Text" lineEndContext="#stay">
100 <DetectSpaces/>
101 <DetectIdentifier/>
102 <StringDetect attribute="CDATA" context="#pop" String="]]&gt;" endRegion="cdata" />
103 <StringDetect attribute="EntityRef" context="#stay" String="]]&amp;gt;" />
104 </context>
105
106 <context name="PI" attribute="Other Text" lineEndContext="#stay">
107 <Detect2Chars attribute="Processing Instruction" context="#pop" char="?" char1="&gt;" endRegion="pi" />
108 </context>
109
110 <context name="Doctype" attribute="Other Text" lineEndContext="#stay">
111 <DetectChar attribute="Doctype" context="#pop" char="&gt;" endRegion="doctype" />
112 <DetectChar attribute="Doctype" context="Doctype Internal Subset" char="[" beginRegion="int_subset" />
113 </context>
114
115 <context name="Doctype Internal Subset" attribute="Other Text" lineEndContext="#stay">
116 <DetectChar attribute="Doctype" context="#pop" char="]" endRegion="int_subset" />
117 <IncludeRules context="FindDTDRules" />
118 <StringDetect attribute="Comment" context="Comment" String="&lt;!--" beginRegion="comment" />
119 <RegExpr attribute="Processing Instruction" context="PI" String="&lt;\?[\w:-]*" beginRegion="pi" />
120 <IncludeRules context="FindPEntityRefs" />
121 </context>
122
123 <context name="Doctype Markupdecl" attribute="Other Text" lineEndContext="#stay">
124 <DetectChar attribute="Doctype" context="#pop" char="&gt;" />
125 <DetectChar attribute="Value" context="Doctype Markupdecl DQ" char="&quot;" />
126 <DetectChar attribute="Value" context="Doctype Markupdecl SQ" char="&apos;" />
127 </context>
128
129 <context name="Doctype Markupdecl DQ" attribute="Value" lineEndContext="#stay">
130 <DetectChar attribute="Value" context="#pop" char="&quot;" />
131 <IncludeRules context="FindPEntityRefs" />
132 </context>
133
134 <context name="Doctype Markupdecl SQ" attribute="Value" lineEndContext="#stay">
135 <DetectChar attribute="Value" context="#pop" char="&apos;" />
136 <IncludeRules context="FindPEntityRefs" />
137 </context>
138
139 <context name="El Open" attribute="Other Text" lineEndContext="#stay">
140 <Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" />
141 <DetectChar attribute="Element" context="#pop" char="&gt;" />
142 <IncludeRules context="FindAttributes" />
143 <RegExpr attribute="Error" context="#stay" String="\S" />
144 </context>
145
146 <context name="El Close" attribute="Other Text" lineEndContext="#stay">
147 <DetectChar attribute="Element" context="#pop" char="&gt;" />
148 <RegExpr attribute="Error" context="#stay" String="\S" />
149 </context>
150
151 <context name="El Close 2" attribute="Other Text" lineEndContext="#stay">
152 <DetectChar attribute="Element" context="#pop#pop#pop" char="&gt;" />
153 <RegExpr attribute="Error" context="#stay" String="\S" />
154 </context>
155
156 <context name="El Close 3" attribute="Other Text" lineEndContext="#stay">
157 <DetectChar attribute="Element" context="#pop#pop#pop#pop" char="&gt;" />
158 <RegExpr attribute="Error" context="#stay" String="\S" />
159 </context>
160
161 <context name="CSS" attribute="Other Text" lineEndContext="#stay">
162 <Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" endRegion="style" />
163 <DetectChar attribute="Element" context="CSS content" char="&gt;" />
164 <IncludeRules context="FindAttributes" />
165 <RegExpr attribute="Error" context="#stay" String="\S" />
166 </context>
167
168 <context name="CSS content" attribute="Other Text" lineEndContext="#stay">
169 <RegExpr attribute="Element" context="El Close 2" String="&lt;/style\b" insensitive="true" endRegion="style" />
170 <IncludeRules context="##CSS" includeAttrib="true"/>
171 </context>
172
173 <context name="JS" attribute="Other Text" lineEndContext="#stay">
174 <RegExpr attribute="Attribute" context="Script-Type" String="(?:\s+|^)type(?=\=|\s|$)" insensitive="true"/>
175 <DetectChar attribute="Element" context="JS content" char="&gt;" />
176 <IncludeRules context="DefaultJS" />
177 </context>
178 <context name="DefaultJS" attribute="Other Text" lineEndContext="#stay">
179 <Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" endRegion="script" />
180 <IncludeRules context="FindAttributes" />
181 <RegExpr attribute="Error" context="#stay" String="\S" />
182 </context>
183
184 <context name="JS content" attribute="Other Text" lineEndContext="#stay">
185 <IncludeRules context="Default JS content"/>
186 <IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
187 </context>
188 <context name="Default JS content" attribute="Other Text" lineEndContext="#stay">
189 <RegExpr attribute="Element" context="El Close 2" String="&lt;/script\b" insensitive="true" endRegion="script" />
190 <RegExpr attribute="Comment" context="JS comment close" String="//(?=.*&lt;/script\b)" insensitive="true" />
191 </context>
192
193 <context name="JS comment close" attribute="Comment" lineEndContext="#pop">
194 <RegExpr attribute="Element" context="El Close 3" String="&lt;/script\b" insensitive="true" endRegion="script" />
195 <DetectSpaces />
196 <IncludeRules context="##Comments" />
197 </context>
198
199 <context name="Value" attribute="Other Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="Value NQ">
200 <DetectChar attribute="Value" context="Value DQ" char="&quot;" />
201 <DetectChar attribute="Value" context="Value SQ" char="&apos;" />
202 <DetectSpaces />
203 </context>
204
205 <context name="Value NQ" attribute="Other Text" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
206 <IncludeRules context="FindEntityRefs" />
207 <RegExpr attribute="Value" context="#stay" String="/(?!&gt;)|[^/&gt;&lt;&quot;&apos;\s]" />
208 </context>
209
210 <context name="Value DQ" attribute="Value" lineEndContext="#stay">
211 <DetectChar attribute="Value" context="#pop#pop" char="&quot;" />
212 <IncludeRules context="FindEntityRefs" />
213 </context>
214
215 <context name="Value SQ" attribute="Value" lineEndContext="#stay">
216 <DetectChar attribute="Value" context="#pop#pop" char="&apos;" />
217 <IncludeRules context="FindEntityRefs" />
218 </context>
219
220 <!-- Read content from the "type" attribute to change the language to
221 highlight in the <script> tag. The default language is JavaScript. -->
222
223 <context name="Script-Type" attribute="Other Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
224 <DetectSpaces />
225 <DetectChar attribute="Attribute" context="#pop!Script-Type Value" char="=" />
226 </context>
227 <context name="Script-Type Value" attribute="Other Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!Value">
228 <DetectSpaces />
229 <!-- TypeScript -->
230 <StringDetect attribute="Value" context="#pop#pop!TypeScript" String="&quot;text/typescript&quot;"/>
231 <StringDetect attribute="Value" context="#pop#pop!TypeScript" String="&apos;text/typescript&apos;"/>
232 <!-- JSX (JavaScript React) -->
233 <StringDetect attribute="Value" context="#pop#pop!JSX" String="&quot;text/jsx&quot;"/>
234 <StringDetect attribute="Value" context="#pop#pop!JSX" String="&apos;text/jsx&apos;"/>
235 <StringDetect attribute="Value" context="#pop#pop!JSX" String="&quot;text/babel&quot;"/>
236 <StringDetect attribute="Value" context="#pop#pop!JSX" String="&apos;text/babel&apos;"/>
237 <!-- MustacheJS / HandlebarsJS / RactiveJS -->
238 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&quot;x-tmpl-mustache&quot;"/>
239 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&apos;x-tmpl-mustache&apos;"/>
240 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&quot;text/mustache&quot;"/>
241 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&apos;text/mustache&apos;"/>
242 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&quot;text/x-mustache-template&quot;"/>
243 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&apos;text/x-mustache-template&apos;"/>
244 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&quot;text/x-handlebars-template&quot;"/>
245 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&apos;text/x-handlebars-template&apos;"/>
246 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&quot;text/ractive&quot;"/>
247 <StringDetect attribute="Value" context="#pop#pop!MustacheJS" String="&apos;text/ractive&apos;"/>
248 <!-- HTML templates -->
249 <StringDetect attribute="Value" context="#pop#pop!Script HTML template" String="&quot;text/html&quot;"/>
250 <StringDetect attribute="Value" context="#pop#pop!Script HTML template" String="&apos;text/html&apos;"/>
251 </context>
252
253 <context name="JSX" attribute="Other Text" lineEndContext="#stay">
254 <DetectChar attribute="Element" context="JSX content" char="&gt;" />
255 <IncludeRules context="DefaultJS" />
256 </context>
257 <context name="JSX content" attribute="Other Text" lineEndContext="#stay">
258 <IncludeRules context="Default JS content"/>
259 <IncludeRules context="Normal##JavaScript React (JSX)" includeAttrib="true"/>
260 </context>
261
262 <context name="TypeScript" attribute="Other Text" lineEndContext="#stay">
263 <DetectChar attribute="Element" context="TypeScript content" char="&gt;" />
264 <IncludeRules context="DefaultJS" />
265 </context>
266 <context name="TypeScript content" attribute="Other Text" lineEndContext="#stay">
267 <IncludeRules context="Default JS content"/>
268 <IncludeRules context="Normal##TypeScript" includeAttrib="true"/>
269 </context>
270
271 <context name="MustacheJS" attribute="Other Text" lineEndContext="#stay">
272 <DetectChar attribute="Element" context="MustacheJS content" char="&gt;" />
273 <IncludeRules context="DefaultJS" />
274 </context>
275 <context name="MustacheJS content" attribute="Other Text" lineEndContext="#stay">
276 <RegExpr attribute="Element" context="El Close 2" String="&lt;/script\b" insensitive="true" endRegion="script" />
277 <StringDetect attribute="Error" context="#stay" String="&lt;script&gt;" insensitive="true" />
278 <RegExpr attribute="Error" context="#stay" String="&lt;script\b" insensitive="true" />
279 <IncludeRules context="Base##Mustache/Handlebars (HTML)" includeAttrib="true"/>
280 </context>
281
282 <context name="Script HTML template" attribute="Other Text" lineEndContext="#stay">
283 <DetectChar attribute="Element" context="Script HTML template content" char="&gt;" />
284 <IncludeRules context="DefaultJS" />
285 </context>
286 <context name="Script HTML template content" attribute="Other Text" lineEndContext="#stay">
287 <RegExpr attribute="Element" context="El Close 2" String="&lt;/script\b" insensitive="true" endRegion="script" />
288 <StringDetect attribute="Error" context="#stay" String="&lt;script&gt;" insensitive="true" />
289 <RegExpr attribute="Error" context="#stay" String="&lt;script\b" insensitive="true" />
290 <IncludeRules context="FindHTML" />
291 </context>
292
293 </contexts>
294 <itemDatas>
295 <itemData name="Normal Text" defStyleNum="dsNormal" />
296 <itemData name="Other Text" defStyleNum="dsNormal" spellChecking="false" />
297 <itemData name="Comment" defStyleNum="dsComment" />
298 <itemData name="CDATA" defStyleNum="dsBaseN" bold="1" spellChecking="false" />
299 <itemData name="Processing Instruction" defStyleNum="dsKeyword" spellChecking="false" />
300 <itemData name="Doctype" defStyleNum="dsDataType" bold="1" spellChecking="false" />
301 <itemData name="Element" defStyleNum="dsKeyword" spellChecking="false" />
302 <itemData name="Attribute" defStyleNum="dsOthers" spellChecking="false" />
303 <itemData name="Value" defStyleNum="dsString" spellChecking="false" />
304 <itemData name="EntityRef" defStyleNum="dsDecVal" spellChecking="false" />
305 <itemData name="PEntityRef" defStyleNum="dsDecVal" spellChecking="false" />
306 <itemData name="Error" defStyleNum="dsError" spellChecking="false" />
307 </itemDatas>
308
309 </highlighting>
310 <general>
311 <comments>
312 <comment name="multiLine" start="&lt;!--" end="--&gt;" region="comment" />
313 </comments>
314 </general>
315 </language>
316 <!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->