[Lisppaste-cvs] CVS update: lisppaste2/web-server.lisp

Brian Mastenbrook bmastenbrook at common-lisp.net
Thu Jun 3 14:16:35 UTC 2004


Update of /project/lisppaste/cvsroot/lisppaste2
In directory common-lisp.net:/home/bmastenbrook/lisppaste2

Modified Files:
	web-server.lisp 
Log Message:
Adventures in compliant HTML and class-ification

Date: Thu Jun  3 07:16:35 2004
Author: bmastenbrook

Index: lisppaste2/web-server.lisp
diff -u lisppaste2/web-server.lisp:1.48 lisppaste2/web-server.lisp:1.49
--- lisppaste2/web-server.lisp:1.48	Tue Jun  1 06:17:50 2004
+++ lisppaste2/web-server.lisp	Thu Jun  3 07:16:35 2004
@@ -1,20 +1,24 @@
-;;;; $Id: web-server.lisp,v 1.48 2004/06/01 13:17:50 bmastenbrook Exp $
+;;;; $Id: web-server.lisp,v 1.49 2004/06/03 14:16:35 bmastenbrook Exp $
 ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $
 
 ;;;; See the LICENSE file for licensing information.
 
 (in-package :lisppaste)
 
-(defstruct paste
-  (number nil :type integer)
-  (user nil :type string)
-  (title nil :type string)
-  (contents nil :type string)
-  (universal-time nil :type integer)
-  (is-annotation nil :type boolean)
-  (annotations nil :type list)
-  (annotation-counter 0 :type integer)
-  (channel "" :type string))
+(defclass paste ()
+  ((number :initarg :number :initform 0 :accessor paste-number)
+   (user :initarg :user :initform "" :accessor paste-user)
+   (title :initarg :title :initform "" :accessor paste-title)
+   (contents :initarg :contents :initform "" :accessor paste-contents)
+   (universal-time :initarg :universal-time :initform 0 :accessor paste-universal-time)
+   (is-annotation :initarg :is-annotation :initform nil :accessor paste-is-annotation)
+   (annotations :initarg :annotations :initform nil :accessor paste-annotations)
+   (annotation-counter :initarg :annotation-counter :initform 0 :accessor paste-annotation-counter)
+   (channel :initarg :channel :initform "" :accessor paste-channel)
+   (colorization-mode :initarg :colorization-mode :initform "" :accessor paste-colorization-mode)))
+
+(defmacro make-paste (&rest arguments)
+  `(make-instance 'paste , at arguments))
 
 (defclass new-paste-handler (araneida:handler) ())
 
@@ -92,7 +96,7 @@
      (t (format nil "~A~A" (time-delta-primitive delta level) (if ago-p " ago" ""))))))
 
 (defun irc-log-link (utime channel)
-  (format nil "http://meme.b9.com/now?utime=~A&channel=~A"
+  (format nil "http://meme.b9.com/now?utime=~A&channel=~A"
           utime
           (string-left-trim "#" channel)))
 
@@ -580,7 +584,8 @@
                        (car (rassoc colorize-string (colorize:coloring-types) :test #'string-equal))
                        (if (and paste
                                 (not (string-equal colorize-string "None")))
-                           (colorize:autodetect-coloring-type (paste-channel paste))))))
+                           (colorize:autodetect-coloring-type (paste-channel paste)))))
+         (colorize:*css-background-class* "paste"))
     (if paste
         (if raw
             (let ((p (position #\, (araneida::request-unhandled-part request) :test #'char=)))
@@ -606,12 +611,14 @@
                (head
                 (title "Paste number " ,paste-number)
                 ((style :type "text/css")
-                 ,colorize:*coloring-css*)
+                 ,(format nil "~A~%~A~%"
+                          (colorize:make-background-css "#F4F4F4")
+                          colorize:*coloring-css*))
                 ,(rss-link-header))
                (body
                 ,(format-paste paste (araneida:urlstring (araneida:request-url request)) paste-number nil colorize-as)
-                ,(if (paste-annotations paste)
-                     `(p
+                ,@(if (paste-annotations paste)
+                     `((p)
                        "Annotations for this paste: "
                        ,@(reduce #'append
                                  (mapcar #'(lambda (a)
@@ -621,7 +628,8 @@
                                                                       (araneida:urlstring (araneida:request-url request))
                                                                       (paste-number a)) (paste-number a) t colorize-as)))
                                          (reverse (paste-annotations paste)))))
-                     `(p "This paste has no annotations."))
+                     `((p) "This paste has no annotations."))
+                (p)
                 ((form :method post :action ,(araneida:urlstring
                                               (araneida:merge-url
                                                *display-paste-url*
@@ -634,7 +642,7 @@
                                    ,@(if (eq
                                           (car pair)
                                           colorize-as)
-                                         '(:selected "true")))
+                                         '(:selected "SELECTED")))
                                   ,(cdr pair)))
                             (colorize:coloring-types)))
                  ((input :type submit :value "Colorize")))





More information about the Lisppaste-cvs mailing list