r3072: *** empty log message ***
[kmrcl.git] / ml-class.lisp
index c3d20406c47b2c816bee4473e7e0db5d601170c1..b720de00351cd7d5dcb936a8c10d47c8529a00a8 100644 (file)
@@ -11,7 +11,7 @@
 ;;;; in Text, HTML, and XML formats. This includes hyperlinking
 ;;;; capability and sub-objects.
 ;;;;
-;;;; $Id: ml-class.lisp,v 1.13 2002/10/16 05:57:12 kevin Exp $
+;;;; $Id: ml-class.lisp,v 1.17 2002/10/16 21:58:49 kevin Exp $
 ;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -195,9 +195,9 @@ Format is ((field-name field-lookup-func other-link-params) ...)")
              (string-append fmtstr-html-ref-labels " ")
              (string-append fmtstr-xml-ref-labels " ")))
          
-         (setq html-str value-fmt)
+         (setq html-str (concatenate 'string "<span class=\"" namestr-lower "\">" value-fmt "</span>"))
          (setq xml-str (concatenate 'string "<" namestr-lower ">" value-fmt "</" namestr-lower ">"))
-         (setq html-label-str (concatenate 'string "<i>" namestr-lower "</i> " value-fmt))
+         (setq html-label-str (concatenate 'string "<span class=\"label\">" namestr-lower "</span> <span class=\"" namestr-lower "\">" value-fmt "</span>"))
          (setq xml-label-str (concatenate 'string "<label>" namestr-lower "</label> <" namestr-lower ">" value-fmt "</" namestr-lower ">"))
          
          (string-append fmtstr-text value-fmt)
@@ -211,7 +211,7 @@ Format is ((field-name field-lookup-func other-link-params) ...)")
            (progn
              (string-append fmtstr-html-ref "<~~a>" value-fmt "</~~a>")
              (string-append fmtstr-xml-ref "<~~a>" value-fmt "</~~a>")
-             (string-append fmtstr-html-ref-labels "<i>" namestr-lower "</i> <~~a>" value-fmt "</~~a>")
+             (string-append fmtstr-html-ref-labels "<span class=\"label\">" namestr-lower "</span> <~~a>" value-fmt "</~~a>")
              (string-append fmtstr-xml-ref-labels "<label>" namestr-lower "</label> <~~a>" value-fmt "</~~a>"))
            (progn
              (string-append fmtstr-html-ref html-str)
@@ -230,7 +230,7 @@ Format is ((field-name field-lookup-func other-link-params) ...)")
              (setq xmlvalue-func (append xmlvalue-func (list `(xml-cdata ,@plain-value-func))))
            (setq xmlvalue-func (append xmlvalue-func plain-value-func)))
          ))
-
+      
       (if value-func
          (setq value-func `(lambda (x) (values ,@value-func)))
        (setq value-func `(lambda () (values))))
@@ -401,14 +401,21 @@ Format is ((field-name field-lookup-func other-link-params) ...)")
     :obj-data-end-fmtstr "~%"
     :obj-data-value-func #'ml-class-value-func))
 
+
+(defun class-name-of (obj)
+  (string-downcase (ml-class-name (ml-class-of obj))))
+
+(defun htmlformat-list-start-value-func (x nitems) 
+  (values (ml-class-title x) nitems (class-name-of x)))
+
 (defclass htmlformat (textformat) 
   ()
   (:default-initargs :file-start-str "<html><body>~%"
     :file-end-str "</body><html>~%"
     :list-start-indent t
-    :list-start-fmtstr "<p><b>~a~P:</b></p><ul>~%"
-    :list-start-value-func #'text-list-start-value-func
-    :list-end-fmtstr "</ul>~%"
+    :list-start-fmtstr "<p><b>~a~p:</b></p><div class=\"~A\"><ul>~%"
+    :list-start-value-func #'htmlformat-list-start-value-func
+    :list-end-fmtstr "</ul></div>~%"
     :list-end-indent t
     :list-end-value-func #'identity
     :obj-start-indent t
@@ -420,17 +427,14 @@ Format is ((field-name field-lookup-func other-link-params) ...)")
     :obj-data-indent t
     :obj-data-fmtstr #'ml-class-fmtstr-html-labels
     :obj-data-fmtstr-labels #'ml-class-fmtstr-html-labels
-    :obj-data-value-func #'ml-class-value-func))
-
+    :obj-data-value-func #'ml-class-xmlvalue-func))
 
-(defun class-name-of (obj)
-  (string-downcase (ml-class-name (ml-class-of obj))))
 
 (defun xmlformat-list-end-value-func (x)
-  (format nil "~alist" (string-downcase (ml-class-name (ml-class-of x)))))
+  (format nil "~alist" (class-name-of x)))
 
 (defun xmlformat-list-start-value-func (x nitems) 
-  (values (format nil "~alist" (string-downcase (ml-class-name (ml-class-of x)))) (ml-class-title x) nitems))
+  (values (format nil "~alist" (class-name-of x)) (ml-class-title x) nitems))
 
 (defclass xmlformat (textformat) 
   ()
@@ -471,7 +475,7 @@ Format is ((field-name field-lookup-func other-link-params) ...)")
     :fmtstr-labels #'ml-class-fmtstr-html-ref-labels
     :href-head "a href=" 
     :href-end "a" 
-    :ampersand "&"))
+    :ampersand "&amp;"))
 
 (defclass xml-link-ref (link-ref)
   ()
@@ -669,7 +673,9 @@ Format is ((field-name field-lookup-func other-link-params) ...)")
     (let ((nobjs (length objs)))
       (fmt-list-start (car objs) fmt strm indent nobjs)
       (dolist (obj objs)
-        (unless (and english-only-function (not (funcall english-only-function obj)))
+        (unless (and english-only-function
+                 (multiple-value-bind (eng term) (funcall english-only-function obj)
+                   (and term (not eng))))
           (fmt-obj-start obj fmt strm indent)
           (fmt-obj-data obj fmt strm (1+ indent) label refvars)
           (if subobjects