Changes between Version 1 and Version 2 of GenshiRecipes/AlternatingTableRows
- Timestamp:
- Mar 2, 2008, 7:49:37 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GenshiRecipes/AlternatingTableRows
v1 v2 10 10 11 11 This will produce a table row in the html output with the ''class="odd"'' or ''class="even"'' alternating on each row. 12 13 == Using `itertools.cycle` == 14 15 Pass `itertools.cycle` to your template and: 16 17 {{{ 18 #!genshi 19 <table py:with="cls=cycle(('first', 'second', 'third'))"> 20 <tr py:for="firstname, lastname in nameslist" class="${cls.next()}"> 21 ... 22 }}} 23 24 This will produce table rows cycling through `class="first"`, `class="second"` and `class="third"`.