0
(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")))

这段代码没有输出我想要的。我期望它输出:

<html><head><meta charset='utf-8' /></head><body><div>hello,name</div></body></html>

但是,它输出:

<html><head><meta charset='utf-8' /></head><body><div></div></body></html>

谁能告诉我为什么?我正在使用 SBCL。

4

1 回答 1

4

您的问题是,在 CL-WHO 中,非常量字符串应该str像这样放在里面:

(defmacro rawpage ()
  (:div (str (str+ "hello," "name"))))
于 2013-03-27T15:08:56.507 回答