Open bugadani opened 5 years ago
List rendering does not seem to work at all (at least in Python 3.9.5):
import chevron
import pystache
data = {
'members': [
{ 'name': 'M1' },
{ 'name': 'M2' },
{ 'name': 'M3' },
]
}
tmpl = '''
{{ #members }}
- {{ name }}
{{ /members }}
'''
print('PyStache', pystache.render(tmpl, data))
print('Chevron', chevron.render(tmpl, data))
This results in
PyStache
- M1
- M2
- M3
Chevron
-
The PyStache output is what I would expect.
I'm trying to use chevron in my project, where I was previously using pystache. Pystache was really flexible in what I could pass to it, and it would treat anything as a list, that can be iterated on. While changing to chevron, however, I found that I have to wrap a lot of stuff with list(), mostly dict .keys()/.values() views.
Minimal repro from pyhon console:
I'm using Python 3.7.3