[stringtemplate-interest] Renderer "modes"

Jeremy Gray jgray at siberra.com
Mon Jun 19 13:00:23 PDT 2006


I think I'm starting to see where you're heading with this. I haven't
had a chance to look into the behaviour of overriding the method you
mention, but if you're talking about the SetAttribute I think you're
talking about then I'm not sure whether or not it will do the trick.
That said, I'd best just take this issue away and play with it for a
while rather than ramble to the mailing list about things I haven't yet
tried. :)

Jeremy

-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Terence
Parr
Sent: Monday, June 19, 2006 12:32 PM
To: stringtemplate-interest
Subject: Re: [stringtemplate-interest] Renderer "modes"


On Jun 19, 2006, at 12:25 PM, Jeremy Gray wrote:

> Hmm. I hadn't realized that subclassing ST was an option, and  
> admittedly
> didn't gather that impression from your papers.

I'm pretty sure that that same section shows subclassing to override  
setAttribute.  My cutpaste stopped at the spot.

> Still, I am not having
> an easy time imagining how auto-wrapping all dates would allow for the
> conditional behaviour I was describing where a date might be formatted
> one way once in a template and another way elsewhere. Perhaps  
> something
> just hasn't clicked in my mind yet. I'll have to think about it for a
> bit.

If the wrapper has two methods, getMedium and getVerbose, then you  
can have templates say:

$mydate.medium$
$mydate.verbose$

The first calls getMedium() on the wrapper which formats the data  
held in that object.

Does that help?

Ter

_______________________________________________
stringtemplate-interest mailing list
stringtemplate-interest at antlr.org
http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest




More information about the stringtemplate-interest mailing list