[bknr-cvs] r2434 - in branches/trunk-reorg/bknr/web/src: . rss web

hhubner at common-lisp.net hhubner at common-lisp.net
Thu Jan 31 12:53:39 UTC 2008


Author: hhubner
Date: Thu Jan 31 07:53:36 2008
New Revision: 2434

Modified:
   branches/trunk-reorg/bknr/web/src/packages.lisp
   branches/trunk-reorg/bknr/web/src/rss/rss.lisp
   branches/trunk-reorg/bknr/web/src/web/handlers.lisp
   branches/trunk-reorg/bknr/web/src/web/rss-handlers.lisp
   branches/trunk-reorg/bknr/web/src/web/templates.lisp
Log:
Fix some RSS related problems.
Extend RSS API so that encoded content can be generated.
Begin removing all code that depends on :rune-is-integer.  Raymond
Toy says that he'll add Unicode support to CMUCL, and I'm sick of
the string-related kludging.


Modified: branches/trunk-reorg/bknr/web/src/packages.lisp
==============================================================================
--- branches/trunk-reorg/bknr/web/src/packages.lisp	(original)
+++ branches/trunk-reorg/bknr/web/src/packages.lisp	Thu Jan 31 07:53:36 2008
@@ -65,6 +65,7 @@
 	   #:rss-item-enclosure
 	   #:rss-item-guid
 	   #:rss-item-source
+	   #:rss-item-encoded-content
 
 	   ;; textinput
 	   #:rss-textinput

Modified: branches/trunk-reorg/bknr/web/src/rss/rss.lisp
==============================================================================
--- branches/trunk-reorg/bknr/web/src/rss/rss.lisp	(original)
+++ branches/trunk-reorg/bknr/web/src/rss/rss.lisp	Thu Jan 31 07:53:36 2008
@@ -74,6 +74,7 @@
   (with-xml-output (make-character-stream-sink stream)
     (with-element "rss"
       (attribute "version" "2.0")
+      (attribute* "xmlns" "content" "http://purl.org/rss/1.0/modules/content/")
       (with-element "channel"
 	(dolist (slot '(title link description))
 	  (render-mandatory-element channel slot))
@@ -145,7 +146,10 @@
 	 (with-element "description"
 	   (cdata it)))
     (with-element "pubDate"
-      (text (format-date-time (rss-item-pub-date item) :mail-style t)))))
+      (text (format-date-time (rss-item-pub-date item) :mail-style t)))
+    (aif (rss-item-encoded-content item)
+	 (with-element* ("content" "encoded" )
+	   (cdata it)))))
 
 ;; All items present on an RSS stream can implement the access
 ;; methods below.
@@ -169,4 +173,8 @@
 (defmethod rss-item-enclosure (item))
 (defmethod rss-item-guid (item))
 (defmethod rss-item-source (item))
-
+(defgeneric rss-item-encoded-content (item)
+  (:documentation "Return the content for ITEM in encoded (usually HTML) form as string.")
+  (:method (item)
+    (declare (ignore item))
+    nil))

Modified: branches/trunk-reorg/bknr/web/src/web/handlers.lisp
==============================================================================
--- branches/trunk-reorg/bknr/web/src/web/handlers.lisp	(original)
+++ branches/trunk-reorg/bknr/web/src/web/handlers.lisp	Thu Jan 31 07:53:36 2008
@@ -427,9 +427,7 @@
 (defmethod handle :around ((handler xml-handler))
   (with-http-response (:content-type "text/xml")
     (with-http-body ()
-      (let ((sink (#-rune-is-integer cxml:make-character-stream-sink
-				       #+rune-is-integer cxml:make-character-stream-sink/utf8
-				       *html-stream* :canonical t))
+      (let ((sink (cxml:make-character-stream-sink *html-stream* :canonical t))
 	    (style-path (or (query-param "style")
 			    (xml-handler-style-path handler))))
 	(cxml:with-xml-output sink

Modified: branches/trunk-reorg/bknr/web/src/web/rss-handlers.lisp
==============================================================================
--- branches/trunk-reorg/bknr/web/src/web/rss-handlers.lisp	(original)
+++ branches/trunk-reorg/bknr/web/src/web/rss-handlers.lisp	Thu Jan 31 07:53:36 2008
@@ -11,5 +11,4 @@
 (defmethod handle-object ((handler rss-handler) (channel bknr.rss:rss-channel))
   (with-http-response (:content-type "text/xml; charset=UTF-8")
     (with-http-body ()
-      (html (:princ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
-	    (bknr.rss:rss-channel-xml channel *html-stream*)))))
+      (bknr.rss:rss-channel-xml channel *html-stream*))))

Modified: branches/trunk-reorg/bknr/web/src/web/templates.lisp
==============================================================================
--- branches/trunk-reorg/bknr/web/src/web/templates.lisp	(original)
+++ branches/trunk-reorg/bknr/web/src/web/templates.lisp	Thu Jan 31 07:53:36 2008
@@ -103,8 +103,7 @@
 (defun emit-template (expander stream node env)
   (let* ((*template-expander* expander)
          (*template-env* env)
-         (sink (#-rune-is-integer cxml:make-character-stream-sink #+rune-is-integer cxml:make-character-stream-sink/utf8
-				    stream :canonical nil))
+         (sink (cxml:make-character-stream-sink stream :canonical nil))
          (*html-sink* (cxml:make-recoder sink #'cxml::utf8-string-to-rod)))
     (if (node-attribute node "suppress-xml-headers")
 	(emit-template-node node)



More information about the Bknr-cvs mailing list