| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language> |
| 3 |
<language name="Haml" version="14" kateversion="5.63" section="Markup" |
| 4 |
extensions="*.haml" |
| 5 |
author="Cies Breijs (cies_at_kde_nl)" license="LGPL" |
| 6 |
mimetype="text/x-haml"> |
| 7 |
<!-- mimetype="text/x-haml" this might be a problem as is doesn't exist --> |
| 8 |
|
| 9 |
<!-- learned and copied a lot from rhtml.xml --> |
| 10 |
<!-- ripped out some functionality from rhtml, like GDL, maybe put this back in some day... --> |
| 11 |
<!-- rhtml is rails specific, i ripped the rails helper keywords out as i'm a _merb_ guy... --> |
| 12 |
|
| 13 |
<!-- 1.1: fixed many many many buggers, clearly shows how arbitrary the title '1.0' was --> |
| 14 |
|
| 15 |
<!-- TODO: multi-line-based-on-indenting (comments, filters) don't work, mark more errors with error_hl_test.haml(?) (currently only unpaired spaces on indentation), give ruby code a little background, pipe character as a multiline splitter can use a little color (can it be escaped? "\|"), use hamls unittests for inspiration for better *_test.haml files --> |
| 16 |
|
| 17 |
<highlighting> |
| 18 |
<contexts> |
| 19 |
<context attribute="Normal Text" lineEndContext="#stay" name="normal" > |
| 20 |
<RegExpr attribute="Error" firstNonSpace="false" context="#stay" String="^ ( )*[^ ]+" column="0" /> |
| 21 |
<StringDetect attribute="Doctype" context="Doctype" String="!!!" column="0"/> |
| 22 |
|
| 23 |
<!-- 2 failed attempts to implement multiline comments --> |
| 24 |
|
| 25 |
<!-- <RegExpr attribute="Comment" String="/.*$" context="#stay" beginRegion="comment0" column="0"/> |
| 26 |
<RegExpr attribute="Comment" String="[^ /]" context="#stay" endRegion="comment0" column="0"/> |
| 27 |
|
| 28 |
<RegExpr attribute="Comment" String="^[ ]{2}/.*$" context="#stay" beginRegion="comment2" column="0"/> |
| 29 |
<RegExpr attribute="Comment" String="^[^ ]{4}" context="#stay" endRegion="comment2" column="0"/>--> |
| 30 |
|
| 31 |
<!-- <RegExpr attribute="Comment" context="comment0" String="^/.*" /> |
| 32 |
<RegExpr attribute="Comment" context="comment2" String="^[ ]{2}/.*" /> |
| 33 |
<RegExpr attribute="Comment" context="comment4" String="^[ ]{4}/.*" />--> |
| 34 |
|
| 35 |
<!-- match filters for special syntax highlighting before detecting spaces so we know how far we need to indent --> |
| 36 |
<IncludeRules context="Detect filter" /> |
| 37 |
|
| 38 |
<DetectChar attribute="Escaped Text" context="escaped" char="\" /> |
| 39 |
<DetectChar attribute="Comment" context="comment" char="/" /> |
| 40 |
|
| 41 |
<Detect2Chars attribute="Keyword" context="unquoted" char="=" char1="=" /> |
| 42 |
<AnyChar attribute="Keyword" context="rubysourceline" String="=-~" /> |
| 43 |
<Detect2Chars attribute="Keyword" context="rubysourceline" char="!" char1="=" /> |
| 44 |
<Detect2Chars attribute="Keyword" context="rubysourceline" char="&" char1="=" /> |
| 45 |
|
| 46 |
<!-- HAML can do Ruby substitution anywhere in the template --> |
| 47 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 48 |
|
| 49 |
<DetectChar attribute="Operator" context="array" char="[" beginRegion="Array" /> |
| 50 |
<DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" /> |
| 51 |
|
| 52 |
<RegExpr attribute="Tag" firstNonSpace="true" context="#stay" String="%[a-zA-Z_][a-zA-Z0-9_\-]*" /> |
| 53 |
<RegExpr attribute="Div Id" firstNonSpace="true" context="#stay" String="#[a-zA-Z_][a-zA-Z0-9_\-]*" /> |
| 54 |
<RegExpr attribute="Div Class" firstNonSpace="true" context="#stay" String="\.[a-zA-Z_][a-zA-Z0-9_\-]*" /> |
| 55 |
<RegExpr attribute="Element Id" context="#stay" String="#[a-zA-Z_][a-zA-Z0-9_\-]*" /> |
| 56 |
<RegExpr attribute="Element Class" context="#stay" String="\.[a-zA-Z_][a-zA-Z0-9_\-]*" /> |
| 57 |
<RegExpr attribute="Entity" context="#stay" String="&[a-zA-Z]+;" /> |
| 58 |
</context> |
| 59 |
|
| 60 |
<context attribute="Normal Text" lineEndContext="#pop" name="Detect filter"> |
| 61 |
<RegExpr attribute="Filter" column="0" context="filterRuby" String="^(\s*):ruby\b" /> |
| 62 |
<RegExpr attribute="Filter" column="0" context="filterCSS" String="^(\s*):css\b" /> |
| 63 |
<RegExpr attribute="Filter" column="0" context="filterCoffeeScript" String="^(\s*):coffee(?:script)?\b" /> |
| 64 |
<RegExpr attribute="Filter" column="0" context="filterERB" String="^(\s*):erb\b" /> |
| 65 |
<RegExpr attribute="Filter" column="0" context="filterPlain" String="^(\s*):[a-zA-Z0-9_\-]*\b" /> |
| 66 |
<DetectSpaces context="#pop#pop!normal" /> |
| 67 |
</context> |
| 68 |
|
| 69 |
<context attribute="Normal Text" lineEndContext="#stay" name="filterRuby"> |
| 70 |
<!-- detect base indentation + 1 whitespace for code --> |
| 71 |
<StringDetect context="rubysourceline" String="%1 " dynamic="true" /> |
| 72 |
<!-- any other indentation means we're done here --> |
| 73 |
<IncludeRules context="Detect filter" /> |
| 74 |
</context> |
| 75 |
|
| 76 |
<context attribute="Normal Text" lineEndContext="#stay" name="filterCoffeeScript"> |
| 77 |
<!-- detect base indentation + 1 whitespace for code --> |
| 78 |
<StringDetect context="coffeesourceline" String="%1 " dynamic="true" /> |
| 79 |
<!-- any other indentation means we're done here --> |
| 80 |
<IncludeRules context="Detect filter" /> |
| 81 |
</context> |
| 82 |
|
| 83 |
<context attribute="Normal Text" lineEndContext="#stay" name="filterCSS"> |
| 84 |
<!-- detect base indentation + 1 whitespace for code --> |
| 85 |
<StringDetect context="csssourceline" String="%1 " dynamic="true" /> |
| 86 |
<!-- any other indentation means we're done here --> |
| 87 |
<IncludeRules context="Detect filter" /> |
| 88 |
</context> |
| 89 |
|
| 90 |
<context attribute="Normal Text" lineEndContext="#stay" name="filterERB"> |
| 91 |
<!-- detect base indentation + 1 whitespace for code --> |
| 92 |
<StringDetect context="erbsourceline" String="%1 " dynamic="true" /> |
| 93 |
<!-- any other indentation means we're done here --> |
| 94 |
<IncludeRules context="Detect filter" /> |
| 95 |
</context> |
| 96 |
|
| 97 |
<context attribute="Normal Text" lineEndContext="#stay" name="filterPlain"> |
| 98 |
<!-- detect base indentation + 1 whitespace for code --> |
| 99 |
<StringDetect context="plainsourceline" String="%1 " dynamic="true" /> |
| 100 |
<!-- any other indentation means we're done here --> |
| 101 |
<IncludeRules context="Detect filter" /> |
| 102 |
</context> |
| 103 |
|
| 104 |
<context attribute="Operator" lineEndContext="#stay" name="array"> |
| 105 |
<DetectSpaces/> |
| 106 |
<DetectChar attribute="Operator" context="#pop" char="]" endRegion="Array" /> |
| 107 |
<IncludeRules context="rubysourceline" /> |
| 108 |
</context> |
| 109 |
|
| 110 |
<context attribute="Hash" lineEndContext="#stay" name="hash"> |
| 111 |
<DetectSpaces/> |
| 112 |
<DetectChar attribute="Operator" context="#pop" char="}" endRegion="Hash" /> |
| 113 |
<IncludeRules context="rubysourceline" /> |
| 114 |
</context> |
| 115 |
|
| 116 |
<context attribute="Unquoted String" lineEndContext="#pop" name="unquoted"> |
| 117 |
<IncludeRules context="Quoted String" /> |
| 118 |
</context> |
| 119 |
|
| 120 |
<!-- <context attribute="Comment" lineEndContext="#pop" name="comment0"> |
| 121 |
<DetectSpaces/> |
| 122 |
<IncludeRules context="##Comments" /> |
| 123 |
<DetectIdentifier/> |
| 124 |
<!- - was commented out <RegExpr attribute="Comment" context="#pop" String="^[^/ ]" endRegion="comment" /> attempt for multiline comments - -> |
| 125 |
</context> |
| 126 |
--> |
| 127 |
<!-- <context attribute="Comment" lineEndContext="#pop" name="comment2"> |
| 128 |
<DetectSpaces/> |
| 129 |
<IncludeRules context="##Comments" /> |
| 130 |
<DetectIdentifier/> |
| 131 |
<RegExpr attribute="Comment" context="#pop" String="^[ ]{2}[^ /]" endRegion="comment" /> |
| 132 |
</context>--> |
| 133 |
|
| 134 |
|
| 135 |
<context attribute="Comment" lineEndContext="#pop" name="comment"> |
| 136 |
<DetectSpaces/> |
| 137 |
<IncludeRules context="##Comments" /> |
| 138 |
<DetectIdentifier/> |
| 139 |
<StringDetect attribute="Comment" context="#pop" String="-->" endRegion="comment" /> |
| 140 |
</context> |
| 141 |
|
| 142 |
<context attribute="Escaped Text" lineEndContext="#pop" name="escaped"> |
| 143 |
</context> |
| 144 |
|
| 145 |
<context name="rubysourceline" attribute="Ruby embedded in haml" lineEndContext="#pop"> |
| 146 |
<!-- ruby ignores newline after \ --> |
| 147 |
<LineContinue attribute="Ruby Normal Text" context="#stay"/> |
| 148 |
<!-- HAML allows lines ending with `,` to continue to the next line --> |
| 149 |
<LineContinue attribute="Ruby Normal Text" context="#stay" char="," /> |
| 150 |
|
| 151 |
<IncludeRules context="##Ruby" /> |
| 152 |
</context> |
| 153 |
|
| 154 |
<context name="csssourceline" attribute="Other code embedded in haml" lineEndContext="#pop"> |
| 155 |
<IncludeRules context="##CSS" /> |
| 156 |
</context> |
| 157 |
|
| 158 |
<context name="coffeesourceline" attribute="Other code embedded in haml" lineEndContext="#pop"> |
| 159 |
<IncludeRules context="##CoffeeScript" /> |
| 160 |
</context> |
| 161 |
|
| 162 |
<context name="erbsourceline" attribute="Other code embedded in haml" lineEndContext="#pop"> |
| 163 |
<IncludeRules context="##Ruby/Rails/RHTML" /> |
| 164 |
</context> |
| 165 |
|
| 166 |
<context name="plainsourceline" attribute="Other code embedded in haml" lineEndContext="#pop" /> |
| 167 |
|
| 168 |
<context name="Quoted String" attribute="String" lineEndContext="#stay"> |
| 169 |
<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> |
| 170 |
<Detect2Chars attribute="String" char="\" char1=""" context="#stay"/> |
| 171 |
<StringDetect attribute="Substitution" String="#@@" context="Short Subst"/> |
| 172 |
<Detect2Chars attribute="Substitution" char="#" char1="@" context="Short Subst"/> |
| 173 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 174 |
<!--HlCChar attribute="Char" context="#pop"/--> |
| 175 |
<DetectChar char=""" attribute="String" context="#pop"/> |
| 176 |
</context> |
| 177 |
|
| 178 |
<!-- Substitutions can be nested --> |
| 179 |
<context name="Subst" attribute="Ruby Normal Text" lineEndContext="#stay"> |
| 180 |
<DetectChar attribute="Substitution" char="}" context="#pop"/> |
| 181 |
<!-- Highlight substitution as code. --> |
| 182 |
<IncludeRules context="##Ruby"/> |
| 183 |
</context> |
| 184 |
|
| 185 |
<context name="Short Subst" attribute="Substitution" lineEndContext="#pop"> |
| 186 |
<!-- Check for e.g.: "#@var#@@xy" --> |
| 187 |
<StringDetect attribute="Substitution" String="#@@" context="#stay"/> |
| 188 |
<Detect2Chars attribute="Substitution" char="#" char1="@" context="#stay"/> |
| 189 |
<RegExpr attribute="Substitution" String="\w(?!\w)" context="#pop"/> |
| 190 |
</context> |
| 191 |
|
| 192 |
<context name="Doctype" attribute="Doctype" lineEndContext="#pop"/> |
| 193 |
</contexts> |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
<itemDatas> |
| 199 |
<!-- Ruby itemData --> |
| 200 |
<itemData name="Ruby Normal Text" defStyleNum="dsNormal"/> |
| 201 |
<itemData name="Ruby embedded in haml" defStyleNum="dsNormal"/> |
| 202 |
<itemData name="Other code embedded in haml" defStyleNum="dsNormal"/> |
| 203 |
|
| 204 |
<itemData name="Keyword" defStyleNum="dsKeyword"/> |
| 205 |
|
| 206 |
<itemData name="String" defStyleNum="dsString"/> |
| 207 |
<itemData name="Escaped Text" defStyleNum="dsChar"/> |
| 208 |
<itemData name="Unquoted String" defStyleNum="dsString"/> |
| 209 |
<itemData name="Substitution" defStyleNum="dsOthers"/> |
| 210 |
|
| 211 |
<!-- use these to mark errors and alerts things --> |
| 212 |
<itemData name="Error" defStyleNum="dsError" /> |
| 213 |
|
| 214 |
<itemData name="Operator" defStyleNum="dsChar"/> |
| 215 |
|
| 216 |
<!-- HAML itemData --> |
| 217 |
|
| 218 |
<itemData name="Normal Text" defStyleNum="dsNormal" /> |
| 219 |
<itemData name="Hash" defStyleNum="dsNormal" /> |
| 220 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 221 |
<itemData name="Doctype" defStyleNum="dsDataType" bold="1" /> |
| 222 |
<itemData name="Filter" defStyleNum="dsOthers" /> |
| 223 |
<itemData name="Element Id" defStyleNum="dsFloat" bold="1" /> |
| 224 |
<itemData name="Element Class" defStyleNum="dsFloat" /> |
| 225 |
<itemData name="Div Id" defStyleNum="dsDecVal" bold="1" /> |
| 226 |
<itemData name="Div Class" defStyleNum="dsDecVal" /> |
| 227 |
<itemData name="Tag" defStyleNum="dsKeyword" /> |
| 228 |
<itemData name="Entity" defStyleNum="dsDecVal" /> |
| 229 |
</itemDatas> |
| 230 |
</highlighting> |
| 231 |
<general> |
| 232 |
<folding indentationsensitive="1" /> |
| 233 |
<emptyLines> |
| 234 |
<emptyLine regexpr="\s+"/> |
| 235 |
</emptyLines> |
| 236 |
<comments> |
| 237 |
<comment name="singleLine" start="/" position="afterwhitespace"/> |
| 238 |
</comments> |
| 239 |
<keywords casesensitive="1"/> |
| 240 |
</general> |
| 241 |
</language> |
| 242 |
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> |