[stringtemplate-interest] "x of n" integer expansion (or sequence expansion)

Jim Idle jimi at temporal-wave.com
Sat Dec 12 10:03:21 PST 2009


Start with this thread...

http://markmail.org/message/4fqk4eyh2ryj5awq

But remember that StringTemplate is the view and so you cannot place any logic in it such as loops or comparisons, this is what the code that creates/handles your model is for. Knowing what n is, then you can add n templates as attributes, but you can create a renderer that will give you the next number in a sequence it tracks and returns the string value of it. Renderers are trivial to crate but try not to break the model/view separation as this is important but a renderer allows you to fly over the radar if you don't keep the concepts in mind.

Jim

> -----Original Message-----
> From: stringtemplate-interest-bounces at antlr.org [mailto:stringtemplate-
> interest-bounces at antlr.org] On Behalf Of Stephen Kestle
> Sent: Saturday, December 12, 2009 4:13 AM
> To: stringtemplate-interest at antlr.org
> Subject: [stringtemplate-interest] "x of n" integer expansion (or
> sequence expansion)
> 
> Given 'n', how would I go about doing an 'x of n' template, where x =
> 1...n?  Perhaps a sequence expansion with "start=1,step=1,end=n".
> 
> This seems like a basic feature that I can't seem to find documentation
> for...
> 
> Can someone elaborate?  (I've been trying to twist my head around this,
> and the closest I came was to do a recursive template call, but then
> realised I can't find documentation for arithmetic (x+1), and if(x>n)
> is
> not supported)
> 
> Cheers
> 
> Stephen
> 
> 
> 
> 
> _______________________________________________
> 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