[stringtemplate-interest] How to fill a <table> grid wise?

Terence Parr parrt at cs.usfca.edu
Wed Oct 10 17:41:33 PDT 2007


Hi.  Unfortunately, I can't think of a way in ST directly at the  
moment.  I'm adding things slowly like length(attribute) etc... and  
probably a list[i..j] range thing makes sense...hmm...we have first,  
tail, last, etc....  We need a split maybe?

I'm about to push 3.1 so now's the time to speak up ;)

Ter
On Oct 10, 2007, at 4:58 PM, StoreAdmin wrote:

> Hi,
>
> I want to fill items into a table grid-wise: i.e. 3 items per row. The
> closest solution I can think of is as following:
>
> <table>
> $items : {
>    $if (i % 3 = 1)$  <tr>  $endif$
>     <td> $it:item_tmpl()$ </td>
> $if (i % 3 = 0)$  </tr>  $endif$
> }
> </table>
>
> which needs a mod(%) expression.
>
> Is there another way to accomplish this without modifying the ST  
> grammar?
> _______________________________________________
> 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