chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Trouble w/ ersatz


From: Matt Gushee
Subject: Re: [Chicken-users] Trouble w/ ersatz
Date: Wed, 7 Nov 2012 20:35:29 -0700

Hi, Ivan--

On Wed, Nov 7, 2012 at 6:07 PM, Ivan Raikov <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]