cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: [RT] StringTemplate: The answer to our templating needs?
Date Fri, 29 Oct 2004 10:49:12 GMT
Tony Collen wrote:
> --------------------------
> Well, I was too quick on the key presses, so here goes again.  Sorry for
> the spam :)
> --------------------------
> "Brought to you by the maniac that brings you ANTLR!"
> 
> A while ago I was investigating different templating languages, and I
> came across one called StringTemplate [1]
> 
> Of particular interest is the author's paper, "Enforcing Model-View
> Separation in Template Engines" [2].  Please read it. It's interesting.
> 
> I don't consider myself a template or grammar/language parsing expert,
> but this guy seems to have put a ton of thought into what makes a good
> templating engine.  Specifically, his work seems grounded in some pretty
> solid language parsing theory.
> 
> Another reason would be because of JXTemplateGenerator.  This generator 
> is arguably one of the most popular combos to use with the "Power Trio" 
> model of Cocoon development.  Unfortunately, the JXTG seemed to be a 
> "one-man-show", and since that one man is gone, the likelihood of the 
> generator getting "proper" maintenance decreases significantly. The code 
> is also huge and scary (at least to me ;) ).
Looks scary but really isn't. The amount of inner classes makes it quite 
problematic to read.

> Additionally, the dual syntax for accessing things through JXPath and 
> JEXL expressions has led to people, including myself, being confused as 
> to when to use each syntax.  Seeing the mixed syntax is even worse.  IMO 
> we need a *single*, easy-to-use syntax for this.
I do not agree. See my other post today in this thread.

> Therefore, I suggest that Cocoon needs a better, simple, minimalistic 
> templating system that's not the JXTemplateGenerator.
> 
> Another good thing: StringTemplate is BSD license.
> 
> Of course, this is a "do-ocracy," but I lack some of the finer knowledge 
> to "do" a StringTemplate generator.
> 
> Do we need a new, (standardized?) or possibly even *gasp* better 
> templating system for Cocoon?  This is where I encourage people to dive 
> in and give their own [RT]s and thoughts on the issue.
JXTG is very good but it lacks a way to extend it with some reusable pieces of 
code (macros).


I have been trying to make some other templating languages be usable with 
cocoon but all of them are generating TEXT and in cocoon xml land this is a 
real problem. Here JXTG is really powerful. It will convert every model value 
to XML safe representation.

- Velocity: does not have a built in support for xmlification. the only way is 
to write some extension that would be awful to use.

- FreeMarker: also generates text but it's got some support for xmlification. 
The problem is that it's got it's own source resolving mechanism that is in 
total contradiction to what cocoon works on. Result: whole resolving and 
caching would have to be thrown away.

I think that all templating languages that are not xml based will also 
introduce character encoding problems.

I say: let's stick to JXTG just add some power with the ability to write more 
sophisticated macros/taglibs.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Mime
View raw message