[stringtemplate-interest] Output formatting issue

Terence Parr parrt at cs.usfca.edu
Wed May 25 16:37:34 PDT 2005


On May 25, 2005, at 10:19 AM, jobapply wrote:
>
>> It relies on the controller to wrap objects in the appropriate
>> "renderer" object.  I'm adding a mapping concept in the next version
>> that lets you pass in a collection of renderers, one for each
>> locale,
>> so you could generically say format dates in this way. :)
>>
>
> I used to think of renderers as of a part of code..

Well they are implemented in code, but used by view

> Could you explain how
>  {$header|truncate:40:"..."}.
> example will be handled with "renderers"?

The problem is the "40".  What if you need to do truncate but not in  
the middle of an HTML tag?  I have been thinking about size of  
strings as you have seen on the list.  I wonder if a truncate  
operator would be useful in general.  I can easily make a renderer  
that truncates, but there is no way to pass it an argument...that is  
specifically disallowed in general as it would be too much like code,  
but perhaps a special operator would satisfy everybody :)

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com



More information about the stringtemplate-interest mailing list