1

当我写我的网页时,我选择使用 common lisp 来构建它。但我得到的只是网页的源代码。但是当我将网页复制到我的 emacs 并重新打开它时,它就可以工作了。我不知道出了什么问题。

我在 lisp 中的代码是

(defmacro standard-page ((&key title) &body body)

(with-html-output-to-string(*standard-output* nil :prologue t :indent t)

 (:html :xmlns "http://www.w3.org/1999/xhtml"
    :xml\:lang "en"
    :lang "en"
    (:head 
     (:meta :http-equiv "Content-Type" :content "text/html;charset=utf-8")
     (:title ,title)
     (:link :type "text/css" :rel "stylesheet" :href "/site.css"))
    (:body
     ,@body))))

(hunchentoot:define-easy-handler (hello :uri "/hello") (name) 
  (setf (hunchentoot:content-type*) "text/plain")
  (standard-page (:title "something new")
          (:h1 "can i do this?")))
4

1 回答 1

2

这看起来不对:

  (setf (hunchentoot:content-type*) "text/plain")

我认为应该text/html代替text/plain.

于 2014-12-02T14:00:02.413 回答