X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=views.lisp;h=27c4af8227c9b0a8d7a07f5d9c2b0bfc17dc5281;hb=2e4157c504372b22c5da62c360d01fdb9d876032;hp=f44f800ac352f93834959b600ef07459ea581d8e;hpb=4675e305339bd8b9f4cc15eb5f2da6036907a301;p=hyperobject.git diff --git a/views.lisp b/views.lisp index f44f800..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.33 2003/05/14 04:28:09 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) @@ -214,6 +213,7 @@ (ppfc-xml tag name type formatter cdata print-func)) (defun ppfc-html-link (name type formatter cdata nlink print-func) + (declare (fixnum nlink)) (vector-push-extend '(write-char #\< s) print-func) (vector-push-extend `(write-string (nth ,(+ nlink nlink) links) s) print-func) (vector-push-extend '(write-char #\> s) print-func) @@ -322,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))) @@ -511,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 - #'(lambda (obj nitems strm) - (format strm "~a~P:~%" - (hyperobject-class-user-name obj) nitems)))) + (eval '(lambda (obj nitems strm) + (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 ":