Lars Lingner napisaƂ(a):

Hi,

> In my template I want to loop through languages like:
> 
> {% for lng in languages %}
> 
> But I couldn't find a way to pass a list or process the passed items to
> a list.
> 
> Is there such a way? How would I pass and access the values?

What about using split method?

$ cat split.py
from jinja2 import Template

a = Template("{% for lang in languages.split(',') %}\
{{ lang }}\n\
{% endfor %}")

print a.render({'languages': 'pl,en,fr'})

$ python split.py
pl
en
fr

$

HTH,
-- 
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to