| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language |
| 3 |
[ |
| 4 |
<!ENTITY name "[A-Za-z_:][\w.:_-]*"> |
| 5 |
<!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);"> |
| 6 |
]> |
| 7 |
<language name="Django HTML Template" version="7" kateversion="5.53" section="Markup" extensions="*.htm;*.html" mimetype="text/html" author="Matthew Marshall ([email protected])" license="LGPL" priority="9"> |
| 8 |
|
| 9 |
<!-- |
| 10 |
Based off of the katepart html syntax highlighting by Wilbert Berendsen. |
| 11 |
|
| 12 |
Email me with any bugs/suggestions/requests! |
| 13 |
--> |
| 14 |
|
| 15 |
<highlighting> |
| 16 |
|
| 17 |
<list name="blocktags"> |
| 18 |
<item>for</item> |
| 19 |
<item>block</item> |
| 20 |
<item>if</item> |
| 21 |
<item>ifequal</item> |
| 22 |
<item>ifnotequal</item> |
| 23 |
<item>ifchanged</item> |
| 24 |
<item>blocktrans</item> |
| 25 |
<item>spaceless</item> |
| 26 |
<item>autoescape</item> |
| 27 |
</list> |
| 28 |
|
| 29 |
<list name="endblocktags"> |
| 30 |
<item>endfor</item> |
| 31 |
<item>endblock</item> |
| 32 |
<item>endif</item> |
| 33 |
<item>endifequal</item> |
| 34 |
<item>endifnotequal</item> |
| 35 |
<item>endifchanged</item> |
| 36 |
<item>endblocktrans</item> |
| 37 |
<item>endspaceless</item> |
| 38 |
<item>endautoescape</item> |
| 39 |
</list> |
| 40 |
|
| 41 |
<contexts> |
| 42 |
<context name="Start" attribute="Normal Text" lineEndContext="#stay"> |
| 43 |
<RegExpr attribute="Mismatched Block Tag" context="#stay" String="\{%\s*end[a-z]+\s*%\}" /> |
| 44 |
<IncludeRules context="FindTemplate" /> |
| 45 |
<IncludeRules context="FindHTML" /> |
| 46 |
</context> |
| 47 |
|
| 48 |
<context name="In Block" attribute="Normal Text" lineEndContext="#stay"> |
| 49 |
<RegExpr context="#pop" String="\{%\s*end[a-z]+\s*%\}" lookAhead="true" /> |
| 50 |
<IncludeRules context="FindTemplate" /> |
| 51 |
<IncludeRules context="FindHTML" /> |
| 52 |
</context> |
| 53 |
|
| 54 |
<context name="FindTemplate" attribute="Normal Text" lineEndContext="#stay"> |
| 55 |
<RegExpr attribute="Template Comment" context="Template Comment" String="\{%\s*comment\s*%\}" beginRegion="templatecomment" /> |
| 56 |
<Detect2Chars attribute="Template Var" context="Template Var" char="{" char1="{" /> |
| 57 |
<Detect2Chars attribute="Template Tag" context="Template Tag" char="{" char1="%" /> |
| 58 |
</context> |
| 59 |
|
| 60 |
<context name="Template Comment" attribute="Template Comment" lineEndContext="#stay"> |
| 61 |
<RegExpr attribute="Template Comment" context="#pop" String="\{%\s*endcomment\s*%\}" endRegion="templatecomment" /> |
| 62 |
<DetectSpaces /> |
| 63 |
<IncludeRules context="##Comments" /> |
| 64 |
</context> |
| 65 |
|
| 66 |
<context name="Template Var" attribute="Template Var" lineEndContext="#stay"> |
| 67 |
<Detect2Chars attribute="Template Var" context="#pop" char="}" char1="}" /> |
| 68 |
<DetectChar attribute="Template Filter" context="Template Filter" char='|' /> |
| 69 |
<Detect2Chars attribute="Error" context="#stay" char="{" char1="{" /> |
| 70 |
<Detect2Chars attribute="Error" context="#stay" char="{" char1="%" /> |
| 71 |
<Detect2Chars attribute="Error" context="#stay" char="%" char1="}" /> |
| 72 |
</context> |
| 73 |
|
| 74 |
<context name="Template Filter" attribute="Template Filter" lineEndContext="#stay"> |
| 75 |
<Detect2Chars attribute="Template Var" context="#pop#pop" char="}" char1="}" /> |
| 76 |
<DetectChar attribute="Template String" char="'" context="Single A-string"/> |
| 77 |
<DetectChar attribute="Template String" char=""" context="Single Q-string"/> |
| 78 |
<Detect2Chars attribute="Error" context="#stay" char="{" char1="{" /> |
| 79 |
<Detect2Chars attribute="Error" context="#stay" char="{" char1="%" /> |
| 80 |
<Detect2Chars attribute="Error" context="#stay" char="%" char1="}" /> |
| 81 |
</context> |
| 82 |
|
| 83 |
<context name="Template Tag" attribute="Template Tag" lineEndContext="#stay"> |
| 84 |
<keyword String="blocktags" context="Found Block Tag" lookAhead="true" attribute="Template Tag" /> |
| 85 |
<DetectIdentifier attribute="Template Tag" context="In Template Tag" /> |
| 86 |
</context> |
| 87 |
|
| 88 |
<context name="Found Block Tag" attribute="Template Tag" lineEndContext="#stay"> |
| 89 |
<!-- This context is entered when a matching block tag was found through lookAhead. We need to capture it in an re, so that it can be matched with the end[blockname] tag later --> |
| 90 |
<RegExpr attribute="Template Tag" String="(&name;)" context="In Block Tag"/> |
| 91 |
</context> |
| 92 |
|
| 93 |
<context name="In Block Tag" attribute="Template Tag Argument" dynamic="true" lineEndContext="#stay" > |
| 94 |
<RegExpr context="#pop#pop#pop" String="\{%\s*end%1\s*%\}" dynamic="true" attribute="Template Tag"/> |
| 95 |
<RegExpr context="Non Matching Tag" String="\{%\s*end[a-z]+\s*%\}" lookAhead="true" /> |
| 96 |
<Detect2Chars attribute="Template Tag" context="In Block" char="%" char1="}" /> |
| 97 |
<IncludeRules context="In Template Tag" /> |
| 98 |
</context> |
| 99 |
|
| 100 |
<context name="Non Matching Tag" attribute="Template Tag" lineEndContext="#stay"> |
| 101 |
<keyword String="endblocktags" attribute="Mismatched Block Tag" context="#pop" /> |
| 102 |
<!-- If the mismatched tag is one we don't know about, ignore it. --> |
| 103 |
<DetectIdentifier attribute="Template Tag" context="#pop" /> |
| 104 |
</context> |
| 105 |
|
| 106 |
<context name="In Template Tag" attribute="Template Tag Argument" lineEndContext="#stay"> |
| 107 |
<Detect2Chars attribute="Template Tag" context="#pop#pop" char="%" char1="}" /> |
| 108 |
<DetectChar attribute="Template String" char="'" context="Single A-string"/> |
| 109 |
<DetectChar attribute="Template String" char=""" context="Single Q-string"/> |
| 110 |
<Detect2Chars attribute="Error" context="#stay" char="{" char1="{" /> |
| 111 |
<Detect2Chars attribute="Error" context="#stay" char="{" char1="%" /> |
| 112 |
<Detect2Chars attribute="Error" context="#stay" char="}" char1="}" /> |
| 113 |
</context> |
| 114 |
|
| 115 |
<context name="Single A-string" attribute="Template String" lineEndContext="#stay"> |
| 116 |
<HlCStringChar attribute="Template String" context="#stay"/> |
| 117 |
<!-- <RegExpr attribute="Operator" String="%[a-zA-Z]" context="#stay"/> --> |
| 118 |
<DetectChar attribute="Template String" char="'" context="#pop"/> |
| 119 |
</context> |
| 120 |
|
| 121 |
<context name="Single Q-string" attribute="Template String" lineEndContext="#stay"> |
| 122 |
<HlCStringChar attribute="Template String" context="#stay"/> |
| 123 |
<!-- <RegExpr attribute="Operator" String="%[a-zA-Z]" context="#stay"/> --> |
| 124 |
<DetectChar attribute="Template String" char=""" context="#pop"/> |
| 125 |
</context> |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
<context name="FindHTML" attribute="Normal Text" lineEndContext="#stay"> |
| 130 |
<DetectSpaces/> |
| 131 |
<DetectIdentifier/> |
| 132 |
<StringDetect attribute="Comment" context="Comment" String="<!--" beginRegion="comment" /> |
| 133 |
<StringDetect attribute="CDATA" context="CDATA" String="<![CDATA[" beginRegion="cdata" /> |
| 134 |
<RegExpr attribute="Doctype" context="Doctype" String="<!DOCTYPE\s+" beginRegion="doctype" /> |
| 135 |
<RegExpr attribute="Processing Instruction" context="PI" String="<\?[\w:-]*" beginRegion="pi" /> |
| 136 |
<RegExpr attribute="Element" context="CSS" String="<style\b" insensitive="true" beginRegion="style" /> |
| 137 |
<RegExpr attribute="Element" context="JS" String="<script\b" insensitive="true" beginRegion="script" /> |
| 138 |
<RegExpr attribute="Element" context="El Open" String="<pre\b" insensitive="true" beginRegion="pre" /> |
| 139 |
<RegExpr attribute="Element" context="El Open" String="<div\b" insensitive="true" beginRegion="div" /> |
| 140 |
<RegExpr attribute="Element" context="El Open" String="<table\b" insensitive="true" beginRegion="table" /> |
| 141 |
<RegExpr attribute="Element" context="El Open" String="<&name;" /> |
| 142 |
<RegExpr attribute="Element" context="El Close" String="</pre\b" insensitive="true" endRegion="pre" /> |
| 143 |
<RegExpr attribute="Element" context="El Close" String="</div\b" insensitive="true" endRegion="div" /> |
| 144 |
<RegExpr attribute="Element" context="El Close" String="</table\b" insensitive="true" endRegion="table" /> |
| 145 |
<RegExpr attribute="Element" context="El Close" String="</&name;" /> |
| 146 |
<!-- as long as kde gives DTDs the text/html mimetype--><IncludeRules context="FindDTDRules" /> |
| 147 |
<IncludeRules context="FindEntityRefs" /> |
| 148 |
</context> |
| 149 |
|
| 150 |
<context name="FindEntityRefs" attribute="Normal Text" lineEndContext="#stay"> |
| 151 |
<RegExpr attribute="EntityRef" context="#stay" String="&entref;" /> |
| 152 |
<AnyChar attribute="Error" context="#stay" String="&<" /> |
| 153 |
</context> |
| 154 |
|
| 155 |
<context name="FindPEntityRefs" attribute="Normal Text" lineEndContext="#stay"> |
| 156 |
<RegExpr attribute="EntityRef" context="#stay" String="&entref;" /> |
| 157 |
<RegExpr attribute="PEntityRef" context="#stay" String="%&name;;" /> |
| 158 |
<AnyChar attribute="Error" context="#stay" String="&%" /> |
| 159 |
</context> |
| 160 |
|
| 161 |
<context name="FindAttributes" attribute="Normal Text" lineEndContext="#stay"> |
| 162 |
<RegExpr attribute="Attribute" context="#stay" String="^&name;|\s+&name;" /> |
| 163 |
<DetectChar attribute="Attribute" context="Value" char="=" /> |
| 164 |
</context> |
| 165 |
|
| 166 |
<context name="FindDTDRules" attribute="Normal Text" lineEndContext="#stay"> |
| 167 |
<RegExpr attribute="Doctype" context="Doctype Markupdecl" String="<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\b" /> |
| 168 |
</context> |
| 169 |
|
| 170 |
|
| 171 |
<context name="Comment" attribute="Comment" lineEndContext="#stay"> |
| 172 |
<DetectSpaces/> |
| 173 |
<IncludeRules context="##Comments" /> |
| 174 |
<IncludeRules context="FindTemplate" /> |
| 175 |
<DetectIdentifier/> |
| 176 |
<StringDetect attribute="Comment" context="#pop" String="-->" endRegion="comment" /> |
| 177 |
<RegExpr attribute="Error" context="#stay" String="-(-(?!->))+" /> |
| 178 |
</context> |
| 179 |
|
| 180 |
<context name="CDATA" attribute="Normal Text" lineEndContext="#stay"> |
| 181 |
<DetectSpaces/> |
| 182 |
<DetectIdentifier/> |
| 183 |
<StringDetect attribute="CDATA" context="#pop" String="]]>" endRegion="cdata" /> |
| 184 |
<StringDetect attribute="EntityRef" context="#stay" String="]]&gt;" /> |
| 185 |
</context> |
| 186 |
|
| 187 |
<context name="PI" attribute="Normal Text" lineEndContext="#stay"> |
| 188 |
<Detect2Chars attribute="Processing Instruction" context="#pop" char="?" char1=">" endRegion="pi" /> |
| 189 |
</context> |
| 190 |
|
| 191 |
<context name="Doctype" attribute="Normal Text" lineEndContext="#stay"> |
| 192 |
<DetectChar attribute="Doctype" context="#pop" char=">" endRegion="doctype" /> |
| 193 |
<DetectChar attribute="Doctype" context="Doctype Internal Subset" char="[" beginRegion="int_subset" /> |
| 194 |
</context> |
| 195 |
|
| 196 |
<context name="Doctype Internal Subset" attribute="Normal Text" lineEndContext="#stay"> |
| 197 |
<DetectChar attribute="Doctype" context="#pop" char="]" endRegion="int_subset" /> |
| 198 |
<IncludeRules context="FindDTDRules" /> |
| 199 |
<StringDetect attribute="Comment" context="Comment" String="<!--" beginRegion="comment" /> |
| 200 |
<RegExpr attribute="Processing Instruction" context="PI" String="<\?[\w:-]*" beginRegion="pi" /> |
| 201 |
<IncludeRules context="FindPEntityRefs" /> |
| 202 |
</context> |
| 203 |
|
| 204 |
<context name="Doctype Markupdecl" attribute="Normal Text" lineEndContext="#stay"> |
| 205 |
<DetectChar attribute="Doctype" context="#pop" char=">" /> |
| 206 |
<DetectChar attribute="Value" context="Doctype Markupdecl DQ" char=""" /> |
| 207 |
<DetectChar attribute="Value" context="Doctype Markupdecl SQ" char="'" /> |
| 208 |
</context> |
| 209 |
|
| 210 |
<context name="Doctype Markupdecl DQ" attribute="Value" lineEndContext="#stay"> |
| 211 |
<DetectChar attribute="Value" context="#pop" char=""" /> |
| 212 |
<IncludeRules context="FindPEntityRefs" /> |
| 213 |
</context> |
| 214 |
|
| 215 |
<context name="Doctype Markupdecl SQ" attribute="Value" lineEndContext="#stay"> |
| 216 |
<DetectChar attribute="Value" context="#pop" char="'" /> |
| 217 |
<IncludeRules context="FindPEntityRefs" /> |
| 218 |
</context> |
| 219 |
|
| 220 |
<context name="El Open" attribute="Normal Text" lineEndContext="#stay"> |
| 221 |
<Detect2Chars attribute="Element" context="#pop" char="/" char1=">" /> |
| 222 |
<DetectChar attribute="Element" context="#pop" char=">" /> |
| 223 |
<IncludeRules context="FindAttributes" /> |
| 224 |
<IncludeRules context="FindTemplate" /> |
| 225 |
<RegExpr attribute="Error" context="#stay" String="\S" /> |
| 226 |
</context> |
| 227 |
|
| 228 |
<context name="El Close" attribute="Normal Text" lineEndContext="#stay"> |
| 229 |
<DetectChar attribute="Element" context="#pop" char=">" /> |
| 230 |
<RegExpr attribute="Error" context="#stay" String="\S" /> |
| 231 |
</context> |
| 232 |
|
| 233 |
<context name="El Close 2" attribute="Normal Text" lineEndContext="#stay"> |
| 234 |
<DetectChar attribute="Element" context="#pop#pop#pop" char=">" /> |
| 235 |
<RegExpr attribute="Error" context="#stay" String="\S" /> |
| 236 |
</context> |
| 237 |
|
| 238 |
<context name="El Close 3" attribute="Normal Text" lineEndContext="#stay"> |
| 239 |
<DetectChar attribute="Element" context="#pop#pop#pop#pop" char=">" /> |
| 240 |
<RegExpr attribute="Error" context="#stay" String="\S" /> |
| 241 |
</context> |
| 242 |
|
| 243 |
<context name="CSS" attribute="Normal Text" lineEndContext="#stay"> |
| 244 |
<Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="style" /> |
| 245 |
<DetectChar attribute="Element" context="CSS content" char=">" /> |
| 246 |
<IncludeRules context="FindAttributes" /> |
| 247 |
<IncludeRules context="FindTemplate" /> |
| 248 |
<RegExpr attribute="Error" context="#stay" String="\S" /> |
| 249 |
</context> |
| 250 |
|
| 251 |
<context name="CSS content" attribute="Normal Text" lineEndContext="#stay"> |
| 252 |
<RegExpr attribute="Element" context="El Close 2" String="</style\b" insensitive="true" endRegion="style" /> |
| 253 |
<IncludeRules context="FindTemplate" /> |
| 254 |
<IncludeRules context="##CSS" includeAttrib="true"/> |
| 255 |
</context> |
| 256 |
|
| 257 |
<context name="JS" attribute="Normal Text" lineEndContext="#stay"> |
| 258 |
<Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="script" /> |
| 259 |
<DetectChar attribute="Element" context="JS content" char=">" /> |
| 260 |
<IncludeRules context="FindTemplate" /> |
| 261 |
<IncludeRules context="FindAttributes" /> |
| 262 |
<RegExpr attribute="Error" context="#stay" String="\S" /> |
| 263 |
</context> |
| 264 |
|
| 265 |
<context name="JS content" attribute="Normal Text" lineEndContext="#stay"> |
| 266 |
<RegExpr attribute="Element" context="El Close 2" String="</script\b" insensitive="true" endRegion="script" /> |
| 267 |
<RegExpr attribute="Comment" context="JS comment close" String="//(?=.*</script\b)" insensitive="true" /> |
| 268 |
<IncludeRules context="FindTemplate" /> |
| 269 |
<IncludeRules context="Normal##JavaScript" includeAttrib="true"/> |
| 270 |
</context> |
| 271 |
|
| 272 |
<context name="JS comment close" attribute="Comment" lineEndContext="#pop"> |
| 273 |
<RegExpr attribute="Element" context="El Close 3" String="</script\b" insensitive="true" endRegion="script" /> |
| 274 |
<IncludeRules context="FindTemplate" /> |
| 275 |
<IncludeRules context="##Comments" /> |
| 276 |
</context> |
| 277 |
|
| 278 |
<context name="Value" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="Value NQ"> |
| 279 |
<DetectChar attribute="Value" context="Value DQ" char=""" /> |
| 280 |
<DetectChar attribute="Value" context="Value SQ" char="'" /> |
| 281 |
<DetectSpaces /> |
| 282 |
</context> |
| 283 |
|
| 284 |
<context name="Value NQ" attribute="Normal Text" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop"> |
| 285 |
<IncludeRules context="FindEntityRefs" /> |
| 286 |
<IncludeRules context="FindTemplate" /> |
| 287 |
<RegExpr attribute="Value" context="#stay" String="/(?!>)|[^/><"'\s]" /> |
| 288 |
</context> |
| 289 |
|
| 290 |
<context name="Value DQ" attribute="Value" lineEndContext="#stay"> |
| 291 |
<DetectChar attribute="Value" context="#pop#pop" char=""" /> |
| 292 |
<IncludeRules context="FindTemplate" /> |
| 293 |
<IncludeRules context="FindEntityRefs" /> |
| 294 |
</context> |
| 295 |
|
| 296 |
<context name="Value SQ" attribute="Value" lineEndContext="#stay"> |
| 297 |
<DetectChar attribute="Value" context="#pop#pop" char="'" /> |
| 298 |
<IncludeRules context="FindTemplate" /> |
| 299 |
<IncludeRules context="FindEntityRefs" /> |
| 300 |
</context> |
| 301 |
|
| 302 |
</contexts> |
| 303 |
<itemDatas> |
| 304 |
<itemData name="Normal Text" defStyleNum="dsNormal" /> |
| 305 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 306 |
<itemData name="CDATA" defStyleNum="dsBaseN" bold="1" /> |
| 307 |
<itemData name="Processing Instruction" defStyleNum="dsKeyword" /> |
| 308 |
<itemData name="Doctype" defStyleNum="dsDataType" bold="1" /> |
| 309 |
<itemData name="Element" defStyleNum="dsKeyword" /> |
| 310 |
<itemData name="Attribute" defStyleNum="dsOthers" /> |
| 311 |
<itemData name="Value" defStyleNum="dsString" /> |
| 312 |
<itemData name="EntityRef" defStyleNum="dsDecVal" /> |
| 313 |
<itemData name="PEntityRef" defStyleNum="dsDecVal" /> |
| 314 |
<itemData name="Error" defStyleNum="dsError" /> |
| 315 |
<itemData name="Template Var" defStyleNum="dsFunction" /> |
| 316 |
<itemData name="Template Tag" defStyleNum="dsFunction" /> |
| 317 |
<itemData name="Template Tag Argument" defStyleNum="dsFunction" /> |
| 318 |
<itemData name="Template String" defStyleNum="dsString" /> |
| 319 |
<itemData name="Template Comment" defStyleNum="dsComment" /> |
| 320 |
<itemData name="Template Filter" defStyleNum="dsOthers" /> |
| 321 |
<itemData name="Mismatched Block Tag" defStyleNum="dsError" /> |
| 322 |
</itemDatas> |
| 323 |
|
| 324 |
</highlighting> |
| 325 |
<general> |
| 326 |
<comments> |
| 327 |
<comment name="multiLine" start="{% comment %}" end="{% endcomment %}" region="templatecomment" /> |
| 328 |
</comments> |
| 329 |
</general> |
| 330 |
</language> |
| 331 |
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> |