(require :cl-who)
(defmacro rawpage ((&rest head) &body body)
`(cl-who:with-html-output-to-string (*standard-output* nil :prologue t)
(:html
(:head
(:meta :charset "utf-8")
,@head)
(:body
,@body))))
(defmacro str+ (&rest strs)
`(concatenate 'string ,@strs))
(rawpage () (:div (str+ "hello," "name")))
This piece of codes does not output what I want. I expected it output:
<html><head><meta charset='utf-8' /></head><body><div>hello,name</div></body></html>
But, it output:
<html><head><meta charset='utf-8' /></head><body><div></div></body></html>
Anyone could tell me why? I'm using SBCL.
Your problem is that in CL-WHO non-constant strings should be placed inside str
like this:
(defmacro rawpage ()
(:div (str (str+ "hello," "name"))))