ESP (Javascript Template Language) syntax highlighting for jEdit

posted 12:48PM Oct 19, 2007 with tags esp javascript jedit jste microsling by Lars Trieloff

I started playing around with Bertrand's microsling (P.S. do not google for the name of the project), which is a minimalized version of the Apache Sling (incubating) framework. Microsling supports two templating languages, Velocity and ESP which is a JSTE-inspired JSP-like syntax for Javascript. As I am a fan of server-side Javascript, I opted for the ESP template language and noted there is no syntax highlighting support in my editor.

With jEdit this is no problem, however. I just copied and adjusted the JSP syntax highlighting definition file, adopted it to ESP and got fine syntax highlighting for ESP files.

http://weblogs.goshaky.com/weblogs/lars/resource/esp-syntax.png

All you need to do is download esp.xml, put it into your jEdit-modes directory (either in the jEdit application folder or in $HOME/.jedit/), and add following line to the catalog file in the same directory:

<MODE NAME="esp" FILE="esp.xml" FILE_NAME_GLOB="*.esp" />

Update: As I learned from Felix, ESP is not inspired by JSTE, it is just very similar. In fact ESP is being used since 2001 by Day. And as I learned from Betrand, it is not Bertrand's microsling, he was just the first to write about it.

| Comments[3]

Comments:

This is one of those examples that completely ignores HTML escaping data. The website is probably full of XSS holes.

Posted by 127.0.0.1 on October 19, 2007 at 01:27 PM CEST #

Actually, this is just an example. Even then XSS is only an issue if you do not trust the author of the input data.

Posted by Lars Trieloff on October 19, 2007 at 01:48 PM CEST #

This is cool! We'll see how ESP picks up but I agree with you that server-side javascript is very well suited for templating.

Although I'm the one who blogged about it, it's not really "Bertrand's microsling" though - I stole most ideas from the "big Sling" initially (the brainchild of Felix Meschberger and other people at Day), and in the meantime microsling has become a community effort.

@127.0.0.1: good observation, we might want to provide an escaping wrapper to access the JCR data. Depending on where it comes from of course, as Lars indicates.

And yes we've found out about the different significations of microsling. Maybe a borat swimsuit logo would be appropriate ;-)

Posted by Bertrand Delacretaz on October 20, 2007 at 10:06 AM CEST #

Post a Comment:
Comments are closed for this entry.