allegroserve: htmlgen: :COMMENT directive

Andrew Philpot <[email protected]> Thu, 18 Jul 2002 17:31:53 -0700
Newsgroups gmane.lisp.open-source.franz
Message-ID <[email protected]>
What's the proper way to use the :COMMENT directive to generate HTML
comments using ALLEGROSERVE?  I'm using 1.1.25.  I downloaded 1.2.21
but didn't install it yet as it didn't seem to have changed in the
relevant part of htmlgen.cl.

I know this seems like a straightforward thing, but since I didn't
find any examples of the use of this directive in the examples.cl, I
just tried a few things, with unexpected results:

(publish :path "/comment1"
	 :content-type  "text/html"
	 :function #'(lambda (req ent)
		       (with-http-response (req ent)
			 (with-http-body (req ent)
			   (html 
			    (:html
			     (:body "Hello World!")
			     (:comment "Comment1")))))))

==> valid document, empty comment


(publish :path "/comment2"
	 :content-type  "text/html"
	 :function #'(lambda (req ent)
		       (with-http-response (req ent)
			 (with-http-body (req ent)
			   (html 
			    (:html
			     (:body "Hello World!")
			     (:comment (:princ "Comment2"))))))))

=> error, attempt to call undefined function :PRINC


(publish :path "/comment3"
	 :content-type  "text/html"
	 :function #'(lambda (req ent)
		       (with-http-response (req ent)
			 (with-http-body (req ent)
			   (html 
			    (:html
			     (:body "Hello World!")
			     (:comment (princ "Comment3" *html-stream*))))))))

=> works!

But isn't it violating the abstraction to have to reference
*HTML-STREAM* during generation?

Confusingly, 

(with-output-to-string (s)
  (html-print '(:comment "Comment4") s))

corresponding more or less to "/comment1" above, works.

=> "<!--Comment4-->"

What am I missing?

Thanks,
Andrew