[stringtemplate-interest] Renderer "modes"
Terence Parr
parrt at cs.usfca.edu
Mon Jun 19 12:31:31 PDT 2006
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
More information about the stringtemplate-interest
mailing list