X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=views.lisp;h=27c4af8227c9b0a8d7a07f5d9c2b0bfc17dc5281;hb=2e4157c504372b22c5da62c360d01fdb9d876032;hp=caf7ad3747831cc5a4ef2808e04abeef1408d040;hpb=7f6cbd20ca01e6f29b4fa7d68a0908864e400320;p=hyperobject.git diff --git a/views.lisp b/views.lisp index caf7ad3..27c4af8 100644 --- a/views.lisp +++ b/views.lisp @@ -7,10 +7,9 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: views.lisp,v 1.34 2003/05/14 04:38:36 kevin Exp $ -;;;; -;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg +;;;; $Id: views.lisp,v 1.38 2003/05/14 06:38:24 kevin Exp $ ;;;; +;;;; This file is Copyright (c) 2000-2003 by Kevin M. Rosenberg ;;;; ************************************************************************* (in-package :hyperobject) @@ -323,12 +322,12 @@ (when (and (view-has-links-p view) (esd-hyperlink slot)) (push (slot-definition-name slot) links))) - (setf (obj-data-print-code view) `(lambda (x s links) - (declare (ignorable links)) - ,@(map 'list #'identity print-func))) - - (setf (obj-data-func view) - (when print-func (compile nil (eval (obj-data-print-code view))))) + (when (plusp (length print-func)) + (setf (obj-data-print-code view) `(lambda (x s links) + (declare (ignorable links)) + ,@(map 'list #'identity print-func))) + (setf (obj-data-func view) + (compile nil (eval (obj-data-print-code view))))) (setf (link-slots view) (nreverse links))) @@ -512,19 +511,28 @@ (defvar +newline-string+ (format nil "~%")) +(defun write-user-name-maybe-plural (obj nitems strm) + (write-string + (if (> nitems 1) + (hyperobject-class-user-name-plural obj) + (hyperobject-class-user-name obj)) + strm)) + (defun initialize-text-view (view) (setf (list-start-str-or-func view) (compile nil (eval '(lambda (obj nitems strm) - (format strm "~a~P:~%" - (hyperobject-class-user-name obj) nitems))))) + (write-user-name-maybe-plural obj nitems strm) + (write-char #\: strm) + (write-char #\Newline strm))))) (setf (list-start-indent view) t) (setf (obj-data-indent view) t) (setf (obj-data-end-str view) +newline-string+)) (defun html-list-start-func (obj nitems strm) - (format strm "

~a~p:

" strm) + (write-user-name-maybe-plural obj nitems strm) + (write-string ":