Arbitrary HTML tags can access the templating engine by prefixing the tag with "al-". Attributes of the tag can then be selectively evaluated to derive their value:
For example:
<al-td colspanexpr="i.span()">
<td colspan="3">
In the following example:
<al-input name="abc.value" disabledbool="abc.isdisabled()">
<input name="abc.value" disabled>
<input name="abc.value">
In the following example, we change the styling of alternate rows in a table:
>>> import albatross
>>> ctx = albatross.SimpleContext('.')
>>> ctx.locals.names = ['Alex', 'Fred', 'Guido', 'Martin', 'Raymond', 'Tim']
>>> albatross.Template(ctx, '<magic>', '''
... <table>
... <al-for iter="i" expr="names">
... <al-tr classexpr="['light', 'dark'][i.index() % 2]" whitespace>
... <td><al-value expr="i.value()" /></td>
... </al-tr>
... </al-for>
... </table>
... ''').to_html(ctx)
>>> ctx.flush_content()
<table>
<tr class="light">
<td>Alex</td>
</tr><tr class="dark">
<td>Fred</td>
</tr><tr class="light">
<td>Guido</td>
</tr><tr class="dark">
<td>Martin</td>
</tr><tr class="light">
<td>Raymond</td>
</tr><tr class="dark">
<td>Tim</td>
</tr></table>