[html-template-devel] Easier way to fill tmpl_var environment?

Edi Weitz edi at agharta.de
Thu Nov 22 17:30:44 UTC 2007


On Wed, 21 Nov 2007 06:43:24 +0000 (UTC), Sohail Somani <sohail at taggedtype.net> wrote:

> First of all, thank you for a nice library.

You're welcome... :)

> Now, I have a question. Is there a way to have html-template call
> back into the calling environment so I don't have to pass all slot
> values of a list of objects in as a list?
>
> So instead of:
>
> ;;; prints "b c"
> (fill-and-print-template "<!-- tmpl_loop ... -->" 
>    (list :a (list :b "b" :c "c")))
>
> I can do something like:
>
> ;;; prints "b c"
> (fill-and-print-template 
>   "<!-- tmpl_callback (b-of a) --> <!-- tmpl_callback (c-of a) -->"
>   (list :a a))
>
> Where b-of and c-of are readers. It is just very very tedious to make 
> lists of all the values.
>
> Does that make any sense?

Not for me.  The design goal of HTML-TEMPLATE is to be as simple as
possible - the idea is that the people working on the HTML don't have
to learn yet another programming language.

I don't understand why you can't achieve what you want within Lisp,
something like

  (fill-and-print-template "<!-- tmpl_loop ... -->" 
    (my-function a))

where MY-FUNCTION builds and returns the structure you need.

Edi.



More information about the Html-template-devel mailing list