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")))
이 코드는 내가 원하는 것을 출력하지 않습니다. 왜CL-WHO 템플릿에 문자열이 표시되지 않습니다.
<html><head><meta charset='utf-8' /></head><body><div></div></body></html>
사람은 말해 줄 수 : 그것은 출력,
<html><head><meta charset='utf-8' /></head><body><div>hello,name</div></body></html>
그러나 : 나는 그것을 출력을 예상? 나는 SBCL을 사용하고있다.
좋은 첫 시작이 할 아마도'(macroexpand-1 '(rawpage() (: div (str + "hello", "name"))))'실제로 무엇이 확장되는지 봅니다. 둘째로,'str +'매크로를'(defun str + (& rest strs) (format nil "~ {~ a ~}"strs)'로 대체하는 것이 더 나을지도 모른다. . – Vatine