[cl-who-devel] should cl-who::*html-mode* be a compile time flag?

Mac Chan emailmac at gmail.com
Fri Mar 30 18:36:30 UTC 2007


On 3/30/07, Edi Weitz <edi at agharta.de> wrote:
>
> I don't remember the details, but I guess this was just an oversight
> of Stefan when he sent the HTML-MODE patch in 2005.  Feel free to send
> a patch to change this behaviour if you think it's worth it.

Sure, attached is a patch for this and also remove extra newlines if
no prologue is specified.

(I sometime log the generated html and the extra newline make the
hunchentoot log very hard to read)

Too bad http://common-lisp.net/~loliveira/ediware/ didn't track as far
back as 2005.
But in this case the change is trivial, otherwise the revision history
will be very helpful.

Thanks,
-- Mac
-------------- next part --------------
==== cl-who/who.lisp#3 - cl-who/who.lisp ====
@@ -224,15 +224,18 @@
             ;; do the same things as above but at runtime
             nconc (list `(let ((,=var= ,val))
                           (cond ((null ,=var=))
-                                ((and (eq ,=var= t) (eq *html-mode* :xml))
-                                 (htm ,(format nil " ~A=~C~A~C"
-                                               (string-downcase attr)
-                                               *attribute-quote-char*
-                                               (string-downcase attr)
-                                               *attribute-quote-char*)))
-                                ((and (eq ,=var= t) (eq *html-mode* :sgml))
-                                 (htm ,(format nil " ~A"
-                                               (string-downcase attr))))
+                                ((eq ,=var= t) 
+                                 ,(case *html-mode*
+                                        (:sgml
+                                         `(htm ,(format nil " ~A"
+                                                        (string-downcase attr))))
+                                        ;; otherwise default to :xml mode
+                                        (t
+                                         `(htm ,(format nil " ~A=~C~A~C"
+                                                        (string-downcase attr)
+                                                        *attribute-quote-char*
+                                                        (string-downcase attr)
+                                                        *attribute-quote-char*)))))
                                 (t
                                  (htm ,(format nil " ~A=~C" (string-downcase attr)
                                                *attribute-quote-char*)
@@ -429,11 +432,10 @@
                                     (and (atom x)
                                          (eq x 'htm)))
                                 (tree-to-commands-aux
-                                 (list* 'htm
-                                        +newline+
-                                        prologue
-                                        +newline+
-                                        (tree-to-template tree))
+                                 (if prologue
+                                     (list* 'htm prologue +newline+
+                                            (tree-to-template tree))
+                                     (cons 'htm (tree-to-template tree)))
                                  stream))))
 
 (defmacro with-html-output ((var &optional stream


More information about the Cl-who-devel mailing list