[cl-who-devel] MACROLET inside HTM

Edi Weitz edi at agharta.de
Tue May 22 22:10:25 UTC 2007


On Tue, 22 May 2007 22:13:58 +0300, Volkan YAZICI <yazicivo at ttnet.net.tr> wrote:

> I've been trying to use MACROLET in HTM with no success:
>
> (with-html-output (*standard-output*)
>   (:div
>    (macrolet ((foo (bar) `(:div ,bar)))
>      (htm
>       (foo "baz")
>       (foo "moo")))))
>
> Here's the fully macroexpand result of the above form:
>
> (LET ((*STANDARD-OUTPUT* *STANDARD-OUTPUT*))
>   (PROGN
>    (WRITE-STRING "<div>" *STANDARD-OUTPUT*)
>    (MACROLET ((FOO (BAR)
>                 `(:DIV ,BAR)))
>      (HTM (:DIV "baz") (:DIV "moo")))
>    (WRITE-STRING "</div>" *STANDARD-OUTPUT*)))
>
> I will be appreciated if anybody would help me to figure out how to
> use MACROLET inside HTM bodies.

You currently can't do that due to the simplistic way CL-WHO expands
the body of WITH-HTML-OUTPUT, and I think there's no easy portable way
to fix that.  (Patches welcome, of course.)

You can, however, define your own tags instead:

  http://weitz.de/cl-who/#convert-tag-to-string-list

HTH,
Edi.



More information about the Cl-who-devel mailing list