Discussion:
MACROLET inside HTM
Volkan YAZICI
2007-05-22 19:13:58 UTC
Permalink
Hi,

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.


Regards.
Edi Weitz
2007-05-22 22:10:25 UTC
Permalink
Post by Volkan YAZICI
(with-html-output (*standard-output*)
(:div
(macrolet ((foo (bar) `(:div ,bar)))
(htm
(foo "baz")
(foo "moo")))))
(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.

Loading...