Neil Jerram <[EMAIL PROTECTED]> writes: > As a further option, please see attached [template.scm]. If you're > interested in this, please let me know, because I may have a more up > to date version somewhere.
I'd be interested in getting hold of the latest version of template.scm as it does exactly what I need for my Guile CGI scripting projects. Also, how to use the process-template macro? Having created the file version.html which reads: <html> <p>This page was processed by Guile $(display (version))$</p> </html> I can get the desired result in a REPL using primitive-eval: guile> (primitive-eval (with-input-from-string (template->code "/path/to/version.html") read)) <html> <p>This page was processed by Guile 1.8.4</p> </html> guile> or, better still, using eval-string: guile> (eval-string (template->code "/path/to/version.html")) <html> <p>This page was processed by Guile 1.8.4</p> </html> guile> but using the process-template macro (with a variable list and module requirement) produces an error: guile> (process-template "/path/to/version.html" ((foo 'bar)) (ice-9 rdelim)) Backtrace: In standard input: 39: 0* (process-template "/path/to/version.html" ((foo (quote bar))) ...) 39: 1 (let* ((module #)) (module-define! module (quote foo) ...) ...) In unknown file: ?: 2 [eval (begin # # # ...) #<module b7cca530>] 1: 3* (begin # # # ...) <unnamed port>:1:1: In expression (begin (display "<html> ") (display " <p>This page was processed by Guile ") ...): <unnamed port>:1:1: Unbound variable: begin ABORT: (unbound-variable) Would it not suffice to evaluate the template code in the environment of the CGI script, i.e., with all the modules loaded and required variables defined in the script before (eval-string (template-code "/path/to/more-complex-template.html")) is called? Could you perhaps provide a simple example usage of process-template? Any guidance much appreciated. Regards, Sebastian