chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Trouble w/ ersatz


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

Hello--

I am trying to use the Ersatz egg to process templates, but I want to pass variables from the calling environment, and it doesn't seem to work. For example:

test.tpl
-----------
<html>
  <head>
    <title>{{ page_title }}</title>
  </head>
  <body>
     <div id="main-content">
        {{ main_content }}
     </div>
  </body>
</html>

And I use code like this:

(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))))))

By the way, I can't tell from the documentation exactly what the correct form of the 'models' argument is; I've tried numerous variations. Anyway, the output file gets generated just fine, but the {{ * }} expressions are simply removed--they are not replaced by the variables. So, am I doing something wrong, or have I found a bug? Any clues appreciated!

--
Matt Gushee

reply via email to

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