[Petal] Is even/odd working in the current version?

Bruno Postle bruno at mkdoc.com
Thu Feb 2 23:22:29 GMT 2006


On Wed 01-Feb-2006 at 12:17 -0500, Jonathan Vanasco wrote:
>
>This is in the docs:

>   <table>
>     <div
>       tal:omit-tag=""
>       tal:repeat="audience self/audiences"
>     >
>       <tr
>         class="odd"
>         tal:condition="true: audience/odd"
>       >
>         <td>
>           This a odd row, it comes before the even row.
>         </td>
>       </tr>
>       <tr
>         class="even"
>         tal:condition="true: audience/even"
>       >
>         <td>
>           This a even row.
>         </td>
>       </tr>
>     </div>
>   </table>

Documentation bug, it should say:

  tal:condition="true: repeat/odd"
  tal:condition="true: repeat/even"

'repeat' is a local temporary object that only exists within a 
petal:repeat loop.  It has a bunch of methods useful for selecting 
different positions in the loop:

  index    # the numeric position
  number   # alias for index
  even     # is the position even
  odd      # is the position odd
  start    # is it the first item
  end      # is it the last item
  inner    # not start or end

Thanks for the bug report, pod is fixed in CVS, added a test too.

-- 
Bruno


More information about the Petal mailing list