[ZPT] creating a definition list with tal
gf
gyromagnetic at gmail.com
Wed Apr 19 10:39:37 EDT 2006
Hi,
I am having difficulties constructing a definition list using tal. I
have searched for relevant information, but have not found anything
useful.
I have a python script 'get_subfolder_info' that returns a list of
dictionaries containing subfolder information [{url1,summary1,alias1},
{url2,summary2,alias2}, ...]
I would like to create something like the following:
<dl>
<dt><a href="url1">alias1</a></dt>
<dd>summary1</dd>
<dt><a href="url2">alias2</a></dt>
<dd>summary2</dd>
...
</dl>
Below I have listed a couple of the variations of code that I have tried.
I'd appreciate any help or advice you can give.
Regards,
gyro
===
The following creates repeated definition lists:
---
<dl tal:define="folder_info get_subfolder_info"
tal:repeat="finfo folder_info">
<dt><a tal:attributes="href finfo/url"
tal:content="finfo/alias">the term</a></dt>
<dd tal:content="finfo/summary">the definition</dd>
</dl>
---
If I include a 'span' to repeat only the dt and dd tagged elements,
the list is not formatted properly (the 'span' messes up the 'dd'
formatting).
<dl tal:define="folder_info get_subfolder_info">
<span tal:repeat="finfo folder_info">
<dt><a tal:attributes="href finfo/url"
tal:content="finfo/alias">the term</a></dt>
<dd tal:content="finfo/summary">the definition</dd>
</span>
</dl>
More information about the ZPT
mailing list