Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  Kate/KWrite + Erltl Syntax Highlighting

dmitriid
Posted: Sat Jan 19, 2008 10:31 am Reply with quote
User Joined: 17 Aug 2006 Posts: 213
First, download and install Kate Erlang syntax highlighting from
http://www.trapexit.org/Special:UserContributions (the site seems down
for now, but look for kate-synatx-highight.tar.gz near the bottom of the
page where the site comes up)


Then create an erltl.xml file in ~/.kde/share/apps/katepart/syntax and
paset the folloing in:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="ErlTL" version="1.00" kateversion="2.1"
section="Scripts" extensions="*.et" mimetype="text/x-erlang" priority="5">
<highlighting>
<contexts>

<context name="start" lineEndContext="#stay" attribute="Normal Text">
<RegExpr context="erltl" attribute="Keyword" String="&lt;%"
beginRegion="erltl" />
<IncludeRules context="##HTML" />
<DetectIdentifier />
</context>

<context name="erltl" attribute="Erltl code" lineEndContext="#stay">
<DetectSpaces />
<StringDetect attribute="Keyword" context="#pop#pop"
String="%&gt;" endRegion="erltl" />
<DetectChar attribute="CommentSymbol" context="onelinecomment"
char="!" />
<DetectChar attribute="FunctionDeclarationSymbol"
context="functiondecl" char="@" />
<DetectChar attribute="TopFormsSymbol" context="topforms"
char="~" />
<DetectChar attribute="TopExprsSymbol" context="topexprs"
char="?" />
<IncludeRules context="##Erlang" />
</context>

<context name="onelinecomment" attribute="Comment"
lineEndContext="#pop">
<StringDetect attribute="Keyword" context="#pop"
lookAhead="true" String="%&gt;" />
</context>

<context name="functiondecl" attribute="Function Declaration"
lineEndContext="#pop">
<StringDetect attribute="Keyword" context="#pop"
lookAhead="true" String="%&gt;" />
</context>

<context name="topforms" attribute="Top Foms" lineEndContext="#pop">
<StringDetect attribute="Keyword" context="#pop"
lookAhead="true" String="%&gt;" />
<IncludeRules context="##Erlang" />
</context>

<context name="topexprs" attribute="Top Exprs" lineEndContext="#pop">
<StringDetect attribute="Keyword" context="#pop"
lookAhead="true" String="%&gt;" />
<IncludeRules context="##Erlang" />
</context>


</contexts>
<itemDatas>
<itemData name="Normal text" defStyleNum="dsNormal" />
<itemData name="Erltl code" defStyleNum="dsNormal" />
<itemData name="Comment" defStyleNum="dsComment" />
<itemData name="Keyword" defStyleNum="dsKeyword" color="#0C225C"
selColor="#ffffff" bold="0" italic="0" />
<itemData name="FunctionDeclarationSymbol"
defStyleNum="dsKeyword" color="#0C225C" selColor="#ffffff" bold="1"
italic="0" />
<itemData name="CommentSymbol" defStyleNum="dsKeyword"
color="#0C225C" selColor="#ffffff" bold="1" italic="0" />
<itemData name="TopFormsSymbol" defStyleNum="dsKeyword"
color="#0C225C" selColor="#ffffff" bold="1" italic="0" />
<itemData name="TopExprsSymbol" defStyleNum="dsKeyword"
color="#0C225C" selColor="#ffffff" bold="1" italic="0" />
<itemData name="Function Declaration" defStyleNum="dsKeyword"
color="#880000" selColor="#ffffff" bold="1" italic="0"
backgroundColor="#F5F5F5" />
<itemData name="HTML Tag" defStyleNum="dsKeyword"
color="#0F0000" selColor="#ffffff" bold="0" italic="0" />
<itemData name="HTML Comment" defStyleNum="dsComment" />
</itemDatas>
</highlighting>
</language>

This is not too pretty and relies on Erlang highlighting to work. But
you can customize it to your own liking in the itemDatas section. If you
are not too happy with HTML code blocking up the view, simply remove the
<IncludeRules context="##HTML" /> line

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum