[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jedit-users
Subject:    Re: [ jEdit-users ] st syntax coloring in jEdit
From:       Vampire <Vampire0 () gmx ! net>
Date:       2007-10-19 22:20:10
Message-ID: 47192D9A.4060100 () gmx ! net
[Download RAW message or body]

Hi Harry,

three things.

Harry schrieb:
> 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. I think every subscriber of this list knows what jEdit is, otherwise 
he wouldn't be subscribed here. *g*
> 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
>   
2. Don't save it in the jEdit program directory and don't change the 
cores catalog file. If you uninstall jEdit, or upgrade it, you loose the 
changes and additions. Instead use ~/.jedit/modes and its catalog file 
as it is there for exact this reason as described in the help. (RTFM for 
more information)
> 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}
>   
3. Are smalltalk files filenames really of the form "foobar.smalltalk"? 
If not, you shouldn't set it to this. And btw. even if you don't assign 
.st files to be string template html files, you can still use 
buffer-local-properties or manual selection for telling jEdit to use the 
string template html edit mode. (RTFM for more information)
> 4) Open the "catalog" file, and add the following mode :
>  
> <MODE NAME="stringtemplatehtml" FILE="stringtemplatehtml.xml"
>     FILE_NAME_GLOB="*.st" />
>  
> and save the file.
>   
See 2.
> 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>&lt;!--</BEGIN>
>    <END>--&gt;</END>
>   </SPAN>
>  
>   <!-- JavaScript -->
>   <SPAN TYPE="MARKUP" DELEGATE="JAVASCRIPT">
>    <BEGIN>&lt;SCRIPT</BEGIN>
>    <END>&lt;/SCRIPT&gt;</END>
>   </SPAN>
>  
>   <!-- stylesheet -->
>   <SPAN TYPE="MARKUP" DELEGATE="CSS">
>    <BEGIN>&lt;STYLE</BEGIN>
>    <END>&lt;/STYLE&gt;</END>
>   </SPAN>
>  
>   <!-- DTD instructions -->
>   <SPAN TYPE="KEYWORD2" DELEGATE="xml::DTD-TAGS">
>    <BEGIN>&lt;!</BEGIN>
>    <END>&gt;</END>
>   </SPAN>
>  
>   <!-- markup tags (here we changed the default to allow st markup also inside
> tags) -->
>   <SPAN TYPE="MARKUP" DELEGATE="TAGS">
>    <BEGIN>&lt;</BEGIN>
>    <END>&gt;</END>
>   </SPAN>
>  
>   <!-- SGML entities -->
>   <SPAN TYPE="LITERAL2" NO_WORD_BREAK="TRUE">
>    <BEGIN>&amp;</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">&gt;</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">&gt;</SEQ>
>  </RULES>
>  
>  <RULES SET="CSS" DEFAULT="MARKUP">
>   <SEQ TYPE="MARKUP" DELEGATE="CSS2">&gt;</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@hmn.aphp.fr
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
-- 
-----------------------------------------------
jEdit Users' List
jEdit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic