Genshi is fantastic !
I did not notice it but a new release of genshi is available. The team at edgewall already famous for trac is doing a great job to ease the generation of xml templates as well as for text templates.
Lately I had to create a list of the available pages on the blog and I was wondering how to do it with a mix of
<py:for each="pagenum in range(1, max_pages+1)">
<py:choose test="">
<li py:when="pagenum==page"><b>$pagenum</b></li>
<li py:when="pagenum==1"><a href="/blogs${base}?page=1">1</a></li>
<li py:when="pagenum==max_pages">
<a href="/blogs${base}?page=$pagenum">$pagenum</a>
</li>
<li py:when="abs(page-pagenum)==1">
<a href="/blogs${base}?page=$pagenum">$pagenum</a>
</li>
<li py:when="abs(page-pagenum)==2"><span py:strip="True">...</span></li>
</py:choose>
</py:for>
This little piece of code will bold the current page, display a link to the first, the last, the previous and the next pages.