[stringtemplate-interest] accept simple expression language

DVD dvd at newfoundmarket.com
Tue May 12 13:40:55 PDT 2009


Except that I need the transformation step being (optional) step of ST 
engine.
Using Javascript can work around in some scenarios. But others might not 
work.
For example, an plain email newletter that may be contributed by vairous 
people.
  I am talking about making ST 100% solution for all template tasks.
A carefully designed synxtax for an expression function could make it happen
and still keep the syntax appearance clear.
(it might also resolve the issues of conditional looping over 
collections, which has similar
issues). I know this could sound going backward to the other template 
systems.

Terence Parr wrote:
> Yep, I like this idea of a transformation step. it's really the way I  
> view things.  For MVC, I view the model as the database any business  
> logic.  The controller is the webpage that pulls from a model,  
> possibly filtering, and then pushing into the view (template).
>
> Ter
> On May 12, 2009, at 12:31 PM, Johan Stuyts wrote:
>
>   
>>> 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
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>>     
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>   



More information about the stringtemplate-interest mailing list