字符串未在CL-WHO模板中呈现

时间:2013-03-27 13:57:09

标签: common-lisp cl-who

(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。

1 个答案:

答案 0 :(得分:4)

你的问题是在CL-WHO中,非常量字符串应放在str内,如下所示:

(defmacro rawpage ()
  (:div (str (str+ "hello," "name"))))
相关问题