[cl-who-devel] Re: Macroexpansion of with-html-output body?
Jeff Cunningham
jeffrey at cunningham.net
Wed Feb 13 04:39:20 UTC 2008
Victor Kryukov wrote:
> Jeff,
>
> That was fast! I'm holding my breath...
>
> Victor.
>
>
Victor,
I'm not sure anything I'm doing really exercises your changes, but I now
have it running on three servers without any sign of trouble (or
difference in output, for that matter).
I sat down this evening to try to understand it better, and for awhile I
thought I might be able to use it to solve a macro expansion problem
that's been bothering me. I don't think it can be applied, but I'm not
sure. Here's a simplified version of a macro I use :
(defmacro section (title &rest body)
`(with-html-output (*standard-output* nil :indent t)
(:table
(:a :name ,title)
(:tr
(:td
(:h2 (str ,title))
, at body)))))
Here is a trivial example showing how I use it:
(section "A Title"
(:p "A cl-who formatted form")
(:p "The body could be any collection of cl-who code"))
What I'd like to be able to do is feed it unexpanded cl-who code like this:
(let ((code1 '("A Title"
(:p "A cl-who formatted form")
(:p "The body could be any collection of cl-who code")))
(code2 '("Another title"
(:h2 "Different code here"))))
(section* code1)
(section* code2))
And I've tried to make the first macro work by wrapping it in a second
one like this:
(defmacro section* (lst)
(let ((ttl (gensym))
(bdy (gensym)))
`(let ((,ttl (car ,lst))
(,bdy (cdr ,lst)))
(section ,ttl ,bdy))))
Of course, the last form isn't right and evaluates without the body
statements. I had expected to use , at bdy in the last form, but that give
an error.
Do you have any idea how to do something like this?
--Jeff
> _______________________________________________
> cl-who-devel site list
> cl-who-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-who-devel
>
>
More information about the Cl-who-devel
mailing list