- --[=[ starts a multiline comment (the '=' chars are optional)
- ]=] ends the multiline comment
- the number of '=' chars in ]=] must match the number of --[=[
Then the body with the contexts. We start in the first context called "Normal Text". When the regular expression --[(=*)[ matches it switches to the context Comment.<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd" >
<language name="Test" version="1.0" kateversion="2.4" section="Markup" extensions="" mimetype="">
<highlighting>
The part (=*) is now available as %1 in the rule below:<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
<RegExpr attribute="Comment" context="Comment" String="--\[(=*)\[" dynamic="true"/>
</context>
The last part is the footer:<context name="Comment" attribute="Comment" lineEndContext="#stay" dynamic="true" >
<RegExpr attribute="Comment" context="#pop" String="\]%1\]" dynamic="true" />
</context>
</contexts>
If you want to know more about Kate's highlighting, have a look at the documentation :) There are also lots of bug reports, so if you want to contribute you can fix them!<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="Comment" defStyleNum="dsComment" />
</itemDatas>
</highlighting>
</language>
PS: As I don't know much about Lua, comments might work differently. That does not really matter, as the example still shows what you can do :)
No comments:
Post a Comment