I am trying to incorporate parenscript into cl-who tree. I tried to insert a small macro but for some reasons I get various errors linke "cl-who:fmt not defined" or ":script not defined".
I guess I need help to figure out the way macros work with cl-who...
(defmacro js-body (&rest body)
`(:script :type "text/javascript"
(fmt
(ps
,@body))))
(with-html-output-to-string (*standard-output* nil :prologue nil :indent nil)
(:html
(:head (:title "Some title"))
(js-body
(defun some-func ()
(alert "Hello!")))))
I think parenscript is not really relevant to the task, so I am looking for some help to figure out why I have these expansion errors.
BTW, when I run
(macroexpand
'(with-html-output-to-string (*standard-output* nil :prologue nil :indent nil)
(:html
(:head (:title "Some title"))
(js-body
(defun some-func ()
(alert "Hello!"))))))
I get:
(LET ((*STANDARD-OUTPUT* (MAKE-STRING-OUTPUT-STREAM :ELEMENT-TYPE 'CHARACTER)))
(UNWIND-PROTECT
(PROGN
(WITH-HTML-OUTPUT (*STANDARD-OUTPUT* NIL :PROLOGUE NIL :INDENT NIL)
(:HTML (:HEAD (:TITLE "Some title"))
(JS-BODY (DEFUN SOME-FUNC () (ALERT "Hello!"))))))
(CLOSE *STANDARD-OUTPUT*))
(GET-OUTPUT-STREAM-STRING *STANDARD-OUTPUT*))
The HyperSpec says: "macroexpand repeatedly expands
form until it is no longer a macro form"
Why js-body or with-html-output doesn't get expanded in this case? I am using sbcl 1.0.18 on Ubuntu.
Thank you!
Andrew