Jeff Watkins wrote:


Using a KID template, I'd like to format a list of elements in a grid. For example:

[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]

rendered in a table as:

.-----------.
: 1 : 2 : 3 :
:---+---+---:
: 4 : 5 : 6 :
:---+---+---:
: 7 : 8 : 9 :
'-----------'

This would be simple using JSP or ASP, but I'm drawing a blank on how to do this in Kid.

(Don't want to use templates, but that's life.)

I typically do it something like this:

<?python
chunked_list = map(None, *[iter(some_list)]*2)
?>
<table>
   <tr py:for="row in chunked_list">
       <td py:for="image in row" align="center">
       </td>
   </tr>
</table>

- jmj

Reply via email to