Hi Matt,
Thanks for trying again to use Ersatz. The models argument is an alist where the key is a symbol (the name of the variable),
and the value is of type tvalue, which is a datatype defined in ersatz-lib.scm. So your example could work as follows:
(let* ( (source
#<<EOF
{% for p in posts %}
<div class="blog-post">
<h3>{{ p.title }}</h3>
<div class="post-body">
{{ p.body }}
</div>
</div>
{% endfor %}
EOF
))
(from-string source models:
`((posts .
,(Tlist
(list (Tobj `((title . ,(Tstr "Post One title"))
(body . ,(Tstr "Post One body"))
))
(Tobj `((title . ,(Tstr "Post Two title"))
(body . ,(Tstr "Post Two body"))
))
))
)
))
This will create an ersatz template variable called "posts" which contains a list of Tobj values. Tobj is the wrapper for objects with named fields in Ersatz.
It is basically equivalent to an alist, except that the values must be Ersatz values (i.e. tvalue datatype).
The above code can be greatly simplified of course, so if you have some typical patterns of template use, just let me know, and I will implement them.
Thanks,