r3263: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 31 Oct 2002 21:07:14 +0000 (21:07 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 31 Oct 2002 21:07:14 +0000 (21:07 +0000)
pubmed.lisp

index 88dcb611b4c13a41cb415fc7c9699759506101c7..eb3c9303207b3335bb4d2545c731a43d16ad709d 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Jun 2001
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Jun 2001
 ;;;;
-;;;; $Id: pubmed.lisp,v 1.4 2002/10/31 20:53:03 kevin Exp $
+;;;; $Id: pubmed.lisp,v 1.5 2002/10/31 21:07:04 kevin Exp $
 ;;;;
 ;;;; This file, part of cl-pubmed, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;;
 ;;;; This file, part of cl-pubmed, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
   "Display an article set to specified stream in specified format"
   (dotimes (i (articles-count artset))
     (print-article (nth i (articles artset)) :os os :format format 
   "Display an article set to specified stream in specified format"
   (dotimes (i (articles-count artset))
     (print-article (nth i (articles artset)) :os os :format format 
-                 :complete complete :print-link print-link)))
+                  :complete complete :print-link print-link))
+  artset)
 
 (defmethod print-article ((art pm-article) &key (os *standard-output*) (format :text)
                                              (complete nil) (print-link t))
   "Display an article"
 
 (defmethod print-article ((art pm-article) &key (os *standard-output*) (format :text)
                                              (complete nil) (print-link t))
   "Display an article"
-  (if (eql format :text)
-      (format os "~a~%~a~%~a~a ~a~%~a~%" 
-             (article-title art)
-             (list-to-delimited-string (article-authors art) ", ")
-             (aif (article-affiliation art)
-                  (format nil "~a~%" it) "")
-             (article-journal art) (article-ref art)
-             (aif (article-abstract art) 
+  (ecase format
+    (:text
+     (format os "~a~%~a~%~a~a ~a~%~a~%" 
+            (article-title art)
+            (list-to-delimited-string (article-authors art) ", ")
+            (aif (article-affiliation art)
+                 (format nil "~a~%" it) "")
+            (article-journal art) (article-ref art)
+            (aif (article-abstract art) 
                  (if complete
                      it
                    "Abstract available") 
                  (if complete
                      it
                    "Abstract available") 
-               "No abstract available")
-             (when complete
-                 (format os "~a~%" (article-mesh-headings art))))
-    
-    (let ((has-link (or (article-abstract art) (article-mesh-headings art))))
-      (when (and print-link has-link)
-       (format os "<a href=\"~a?key=~a\">" (make-url "print-article") (article-pmid art)))
-      (format os "<div class=\"article-title\">~a</div>~%" (article-title art))
-      (when (and print-link has-link)
-       (format os "</a>"))
-      (format os "<div class=\"article-authors\">~a</div>~%"
-             (list-to-delimited-string (article-authors art) ", "))
-      (format os "<div class=\"article-reference\">~a ~a</div>~%" 
-             (article-journal art) (article-ref art))
-      (when (and complete (article-abstract art))
-       (format os "<div class=\"article-abstract\">~a</div>~%" 
-               (article-abstract art)))
-      (when (and complete (article-mesh-headings art))
-       (format os "<div class=\"mesh-heading-title\">Mesh Headings:</div>")
-       (dolist (mh (article-mesh-headings art))
-         (format os "<div class=\"mesh-heading\">~a</div>~%" mh)))
-      (format os "<p/>~%"))))
+                 "No abstract available")
+            (when complete
+              (format os "~a~%" (article-mesh-headings art)))))
+     (:html
+      (let ((has-link (or (article-abstract art) (article-mesh-headings art))))
+       (when (and print-link has-link)
+         (format os "<a href=\"~a?key=~a\">" (make-url "print-article") (article-pmid art)))
+       (format os "<div class=\"article-title\">~a</div>~%" (article-title art))
+       (when (and print-link has-link)
+         (format os "</a>"))
+       (format os "<div class=\"article-authors\">~a</div>~%"
+               (list-to-delimited-string (article-authors art) ", "))
+       (format os "<div class=\"article-reference\">~a ~a</div>~%" 
+               (article-journal art) (article-ref art))
+       (when (and complete (article-abstract art))
+         (format os "<div class=\"article-abstract\">~a</div>~%" 
+                 (article-abstract art)))
+       (when (and complete (article-mesh-headings art))
+         (format os "<div class=\"mesh-heading-title\">Mesh Headings:</div>")
+         (dolist (mh (article-mesh-headings art))
+           (format os "<div class=\"mesh-heading\">~a</div>~%" mh)))
+       (format os "<p/>~%"))))
+  art)
 
 
 ;;; PubMed Query Functions
 
 
 ;;; PubMed Query Functions