X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=views.lisp;h=6c7b9faef997129baff6515a300461f4dd9601fa;hb=647d539c69157228c414905a06253e5d3b193718;hp=3d87a7c7d1c3272b47c724d38dc75beb9cbfa90b;hpb=8df04510a35e76a04399872d24ccdfa322a763ff;p=hyperobject.git diff --git a/views.lisp b/views.lisp index 3d87a7c..6c7b9fa 100644 --- a/views.lisp +++ b/views.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: views.lisp,v 1.39 2003/05/14 06:54:04 kevin Exp $ +;;;; $Id: views.lisp,v 1.45 2003/05/16 07:35:09 kevin Exp $ ;;;; ;;;; This file is Copyright (c) 2000-2003 by Kevin M. Rosenberg ;;;; ************************************************************************* @@ -160,6 +160,17 @@ ) ) +(defmacro write-simple (v s) + `(typecase ,v + (string + (write-string ,v ,s)) + #+allegro + (fixnum + (excl::print-fixnum ,s 10 ,v)) + (symbol + (write-string (symbol-name ,v) ,s)) + (t + (write-string (write-to-string ,v) ,s)))) (defun write-ho-value (obj name type formatter cdata strm) (declare (ignorable type)) @@ -170,13 +181,8 @@ (data (if cdata (kmrcl:xml-cdata fmt-data) fmt-data))) - (typecase data - (string - (write-string data strm)) - (number - (write-string (write-to-string data) strm)) - (t - (format strm "~A" data))))) + (write-simple data strm))) + (defun ppfc-html (title name type formatter cdata print-func) (vector-push-extend '(write-string "" value-fmt ""))) - (:xml - (string-append fmtstr (concatenate 'string "<" namestr-lower ">" value-fmt ""))) - (:html-labels - (string-append fmtstr (concatenate 'string "" namestr-lower " " value-fmt ""))) - (:xhtml-labels - (string-append fmtstr (concatenate 'string "" xml-namestr " " value-fmt ""))) - (:xml-labels - (string-append fmtstr (concatenate 'string " <" xml-tag ">" value-fmt ""))) - ((or :html-link :xhtml-link) - (push name links) - (if (esd-hyperlink slot) - (string-append fmtstr "<~~a>" value-fmt "") - (string-append fmtstr (concatenate 'string "" value-fmt "")))) - ((or :xml-link :ie-xml-link) - (push name links) - (if (esd-hyperlink slot) - (string-append fmtstr "<~~a>" value-fmt "") - (string-append fmtstr (concatenate 'string "<" xml-tag ">" value-fmt "")))) - (:html-link-labels - (push name links) - (if (esd-hyperlink slot) - (string-append fmtstr "" namestr-lower " <~~a>" value-fmt "") - (string-append fmtstr (concatenate 'string "" namestr-lower " " value-fmt "")))) - (:xhtml-link-labels - (push name links) - (if (esd-hyperlink slot) - (string-append fmtstr "" xml-namestr " <~~a>" value-fmt "") - (string-append fmtstr (concatenate 'string "" xml-namestr " " value-fmt "")))) - ((or :xml-link-labels :ie-xml-link-labels) - (push name links) - (if (esd-hyperlink slot) - (string-append fmtstr " <~~a>" value-fmt "") - (string-append fmtstr (concatenate 'string " <" xml-tag ">" value-fmt ""))))) - ) ;; let value-fmt - - (let ((func (if print-formatter - `(,print-formatter (slot-value x (quote ,name))) - `(slot-value x (quote ,name))))) - (when (and (in category :xml :xhtml :xml-link :xhtml-link - :xml-labels :ie-xml-labels - :xhtml-link-labels :xml-link-labels :ie-xml-link - :ie-xml-link-labels) - (or print-formatter - (lisp-type-is-a-string type))) - (setq func `(kmrcl:xml-cdata ,func))) - (push func value-func)) - ))) - - (when value-func - (setq value-func - (compile nil (eval `(lambda (x) (values ,@(nreverse value-func))))))) - - (setf (obj-data-fmtstr view) fmtstr) - (setf (obj-data-value-func view) value-func) - (setf (link-slots view) (nreverse links)) - - (case category - ((or :compact-text :compact-text-labels) - (initialize-text-view view)) - ((or :html :xhtml :html-labels :xhtml-labels) - (initialize-html-view view)) - ((or :xml :xml-labels) - (initialize-xml-view view)) - ((or :html-link :html-link-labels) - (initialize-html-view view) - (setf (link-href-start view) "a href=") - (setf (link-href-end view) "a") - (setf (link-ampersand view) "&")) - ((or :xhtml-link :xhtml-link-labels) - (initialize-html-view view) - (setf (link-href-start view) "a href=") - (setf (link-href-end view) "a") - (setf (link-ampersand view) "&")) - ((or :xml-link :xml-link-labels) - (initialize-xml-view view) - (setf (link-href-start view) - "xmllink xlink:type=\"simple\" xlink:href=") - (setf (link-href-end view) "xmllink") - (setf (link-ampersand view) "&")) - ((or :ie-xml-link :ie-xml-link-labels) - (initialize-xml-view view) - (setf (link-href-start view) "html:a href=") - (setf (link-href-end view) "html:a") - (setf (link-ampersand view) "&")))) - view) - ;;;; ************************************************************************* ;;;; View Data Format Section @@ -549,7 +421,7 @@ (setf (obj-start-str-or-func view) "
  • ") (setf (obj-end-indent view) t) (setf (obj-end-str-or-func view) (format nil "
  • ~%")) - (setf (obj-data-indent view) t)) + (setf (obj-data-indent view) nil)) (defun initialize-xhtml-view (view) (initialize-text-view view) @@ -563,7 +435,7 @@ (setf (obj-start-str-or-func view) "
  • ") (setf (obj-end-indent view) t) (setf (obj-end-str-or-func view) (format nil "
  • ~%")) - (setf (obj-data-indent view) t)) + (setf (obj-data-indent view) nil)) (defun xmlformat-list-end-func (x strm) (write-string "