Hi, Ivan--

On Wed, Nov 7, 2012 at 6:07 PM, Ivan Raikov <[email protected]> wrote:
>
>
>   Thanks for trying to use ersatz


Oh, it's purely out of self-interest, I assure you ;-)


> and sorry for the incomplete documentation.


Hmm, yes ... you know, I have been known to write a sentence or two on
occasion. Maybe I can help with the docs, once I get a better understanding
of how the egg works. It seems to me that probably the best approach is to
have a good explanation for the scheme API on the Chicken wiki, and refer
people to the Jinja2 site for the template syntax.


> The models argument must be an association list, i.e. a list of dotted
> pairs of the form (NAME . VALUE) where NAME is a symbol and VALUE is a
> template value.


... yes, got that ... am I mistaken in thinking that '((a b c) (x y z)) [or
'((a Tstr "foo") (x Tstr "bar"))] is effectively an alist, where the cdr of
each element is itself a pair?


> Your code is mostly correct, except that you are not calling the value
> constructors correctly. The following should work (note use of
> quasiquotation):


Quasiquotes. Hmm, I never would have guessed that.

(with-output-to-file "test.html"
>   (lambda ()
>     (with-input-from-string
>        (from-file "test.tpl" env: (template-std-env) models: `((page_title
> . ,(Tstr "Test Page") )  (main_content . ,(Tstr "This is the content."))))
>         (lambda () (display (read-all))))))
>

That worked. Thank you!


> I have not yet had a chance to use ersatz a lot, so your feedback is
> really appreciated. Let me know if you have any other troubles.
>

Okay ... I expect to be giving it a good workout.

--
Matt Gushee
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to