[prev in list] [next in list] [prev in thread] [next in thread] 

List:       stringtemplate-interest
Subject:    Re: [stringtemplate-interest] "x of n" integer expansion (or
From:       "Jim Idle" <jimi () temporal-wave ! com>
Date:       2009-12-12 18:03:21
Message-ID: c392b168f278ce4f8eaf740d184e1c39 () temporal-wave ! com
[Download RAW message or body]

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@antlr.org [mailto:stringtemplate-
> interest-bounces@antlr.org] On Behalf Of Stephen Kestle
> Sent: Saturday, December 12, 2009 4:13 AM
> To: stringtemplate-interest@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@antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic