[stringtemplate-interest] Output formatting issue

Terence Parr parrt at cs.usfca.edu
Thu May 26 13:00:33 PDT 2005


On May 25, 2005, at 7:19 PM, Tom Bentley wrote:

>> 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 :)
>>
>
> Is having a 40 somewhere in the template really /that much/ like code?

Well, I'm trying to avoid arbitrary function(any-arg-list) which is  
too much like code for my taste because it requires that there be  
types and appropriate relationships between the args that are  
attributes and the functions.

> Perhaps only if that 40 can be the result of some other template,  
> rather than being a literal, or being bound outside the template  
> (i.e. before the template is evaluated).

Perhaps if it's anything but an attribute.  Yes, that would be  
strictly ok. :)

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