html.xml 18 KB

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