[prev in list] [next in list] [prev in thread] [next in thread]
List: stringtemplate-interest
Subject: [stringtemplate-interest] st syntax coloring in jEdit
From: harry.karadimas () hmn ! aphp ! fr (Harry)
Date: 2007-10-11 14:47:49
Message-ID: 0JPR0013I53PLNB0 () mta-2 ! aphp ! fr
[Download RAW message or body]
Hi,
I have added syntax coloring in the jEdit editor for st html templates
(see http://stringtemplate.org),
check it out and tell me if it works for you
(jEdit is a free text editor that you can download at http://jedit.org/).
1) Utilities / jEdit home directory / modes
2) save the "stringtemplate.xml" file (see below) to you jEdit home/modes
directory.
For example on windows :
C:\java_programs\jEdit-4_2\modes\stringtemplatehtml.xml
3) The "st" extension is used by default for smalltalk, you must change this :
Utilities/Global Options...
Change settings for mode: smalltalk
put *.{smalltalk} instead of *.{st}
4) Open the "catalog" file, and add the following mode :
<MODE NAME="stringtemplatehtml" FILE="stringtemplatehtml.xml"
FILE_NAME_GLOB="*.st" />
and save the file.
5) Now you should see st files colorized, if this is not the case try
Utilities / troubleshooting / reload edit modes
Enjoy !
Ironically I derived this edit mode from the edit mode that comes with
jEdit for velocity templates.
---------stringtemplatehtml.xml------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE MODE SYSTEM "xmode.dtd">
<MODE>
<PROPS>
<PROPERTY NAME="commentStart" VALUE="$!" />
<PROPERTY NAME="commentEnd" VALUE="!$" />
</PROPS>
<RULES IGNORE_CASE="TRUE">
<!-- SGML comment -->
<SPAN TYPE="COMMENT1">
<BEGIN><!--</BEGIN>
<END>--></END>
</SPAN>
<!-- JavaScript -->
<SPAN TYPE="MARKUP" DELEGATE="JAVASCRIPT">
<BEGIN><SCRIPT</BEGIN>
<END></SCRIPT></END>
</SPAN>
<!-- stylesheet -->
<SPAN TYPE="MARKUP" DELEGATE="CSS">
<BEGIN><STYLE</BEGIN>
<END></STYLE></END>
</SPAN>
<!-- DTD instructions -->
<SPAN TYPE="KEYWORD2" DELEGATE="xml::DTD-TAGS">
<BEGIN><!</BEGIN>
<END>></END>
</SPAN>
<!-- markup tags (here we changed the default to allow st markup also inside
tags) -->
<SPAN TYPE="MARKUP" DELEGATE="TAGS">
<BEGIN><</BEGIN>
<END>></END>
</SPAN>
<!-- SGML entities -->
<SPAN TYPE="LITERAL2" NO_WORD_BREAK="TRUE">
<BEGIN>&</BEGIN>
<END>;</END>
</SPAN>
<IMPORT DELEGATE="STRINGTEMPLATE" />
</RULES>
<RULES SET="TAGS" DEFAULT="MARKUP" ESCAPE="\">
<SPAN TYPE="KEYWORD3" DELEGATE="STCONTENT">
<BEGIN>$</BEGIN><END>$</END>
</SPAN>
<SPAN TYPE="LITERAL1" DELEGATE="LITERALCONTENT">
<BEGIN>"</BEGIN>
<END>"</END>
</SPAN>
<SPAN TYPE="LITERAL1" DELEGATE="LITERALCONTENT">
<BEGIN>'</BEGIN>
<END>'</END>
</SPAN>
<SEQ TYPE="OPERATOR">=</SEQ>
</RULES>
<RULES SET="STRINGTEMPLATE" ESCAPE="\">
<SPAN TYPE="KEYWORD3" DELEGATE="STCONTENT">
<BEGIN>$</BEGIN>
<END>$</END>
</SPAN>
</RULES>
<RULES SET="JAVASCRIPT" DEFAULT="MARKUP" IGNORE_CASE="TRUE">
<SEQ TYPE="MARKUP" DELEGATE="JAVASCRIPT2">></SEQ>
<!-- handle <SCRIPT SRC="..."> properly -->
<SEQ TYPE="MARKUP" DELEGATE="BACK_TO_HTML">SRC=</SEQ>
</RULES>
<RULES SET="JAVASCRIPT2"
ESCAPE="\"
IGNORE_CASE="FALSE"
HIGHLIGHT_DIGITS="TRUE"
DIGIT_RE="(0x[[:xdigit:]]+[lL]?|[[:digit:]]+(e[[:digit:]]*)?[lLdDfF]?)">
<IMPORT DELEGATE="STRINGTEMPLATE" />
<IMPORT DELEGATE="javascript::MAIN" />
</RULES>
<RULES SET="BACK_TO_HTML" DEFAULT="MARKUP">
<SEQ TYPE="MARKUP" DELEGATE="MAIN">></SEQ>
</RULES>
<RULES SET="CSS" DEFAULT="MARKUP">
<SEQ TYPE="MARKUP" DELEGATE="CSS2">></SEQ>
</RULES>
<RULES SET="CSS2"
IGNORE_CASE="TRUE"
HIGHLIGHT_DIGITS="TRUE"
DIGIT_RE="[[:digit:]]+(pt|pc|in|mm|cm|em|ex|px|ms|s|%)"
NO_WORD_SEP="-_">
<IMPORT DELEGATE="STRINGTEMPLATE" />
<IMPORT DELEGATE="css::MAIN" />
</RULES>
<RULES ESCAPE="\" SET="STCONTENT" DEFAULT="KEYWORD3">
<SPAN DELEGATE="MAIN" TYPE="KEYWORD3">
<BEGIN>{</BEGIN><END>}</END>
</SPAN>
</RULES>
<RULES ESCAPE="\" SET="LITERALCONTENT">
<SPAN DELEGATE="STCONTENT" TYPE="KEYWORD3">
<BEGIN>$</BEGIN><END>$</END>
</SPAN>
</RULES>
</MODE>
-------------------------------------------------------------------------------
Harry Karadimas
______________________________________________________________________
Dr Harry Karadimas Medecin Ingenieur
resp. Recherche et Developpement, Administration Wintel
Departement d'Information Hospitalier (DIH)
C.H.U. Albert Chenevier - Henri Mondor
51, av. du Marechal de Lattre de Tassigny 94010 CRETEIL
tel : (00 33 1) 49 81 21 79 fax : (00 33 1) 49 81 27 08
secr.: (00 33 1) 49 81 23 82 m.el.:harry.karadimas at hmn.aphp.fr
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic