[stringtemplate-interest] accept simple expression language
Johan Stuyts
j.stuyts at javathinker.com
Tue May 12 12:31:34 PDT 2009
> what I meant was a scenario where the webs app let end user create a
> template, say a web page template
> and upload it to the Java web server directory that hosting personal ST
> based
> web publishing CMS. I could publish all the properties (say, O.a, O.b)
> my current model provides for user to use in the ST file. But if one
> user wants
> to diplay the result of a+b, what should I do? Of course, the user
> could request
> me to add a property "c" = a+b. but that would make this CMS quite
> backward
> compared to many other CMS. The worse, it might not make sense
> to add this property to the Java model just for one user, or it might
> end up with thousands
> of properties like this. With a basic expression function in place,
> the end user
> could do basic "scripting" to get what they need without replying on
> developer to provide
> for them., I am talking about basic set of expressions such as simple
> math, string maipulation,
> alike, not a full blown languange. I know it "pollute" a little it would
> make ST a complete solution to me.
>
> In other words, this is a scenario that the model might not be readily
> able to provide author
> with needed values. It does not have to be "add".
How about introducing another step in the rendering pipeline of your CMS?
Your current pipeline looks like this if I am correct:
- CMS retrieves content
- template renders HTML
If you add a content transformation step you end up with this:
- CMS retrieves content
- content is transformed using script written by user
- template renders HTML
The script language could be any language, but I guess JavaScript would be
a good choice as a lot of people who know HTML also know the basics of
JavaScript. And the people that don't should not have a problem picking it
up because they can also write templates.
I think this will be more powerful because you can do so much more with a
scripting environment specifically for transformation. For example:
processing collections will be so much easier than doing it inside a
template.
Regards,
Johan Stuyts
More information about the stringtemplate-interest
mailing list