Subject: Re: Pretty-printing HTML with HTMLgen?
From: (Rob Warnock)
Date: Mon, 28 Jun 2004 05:04:07 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Steven M. Haflich <> wrote:
| I also find it important aethetically that the xml generation operators
| work orthogonally with the rest of Lisp syntax.  One thing I don't
| like about AllegroServe htmlgen is the need to reimplement :if and
| other control syntax. The following fragment should illustrate:
| 	 !(tr (loop for i from 1 to 10 do !(th @(* 100 i))))
| 	 !(tr (loop for i from 1 to 10
| 		  do !(td !((input @type "radio" @name "res" @value i
| 				   (when (eql i res)
| 				     @checked "checked"))))))

Tim Bradshaw's HTOUT and Edi Wietz's CL-WHO provide exactly this mutual
nestability, if you substitute their macrolet "HTM" for your "!" [though
the method of handling optional attributes is a bit different]:

  (htm (:tr (loop for i from 1 to 10
              do (htm (:th (fmt "~d" (* 100 i)))))))
  (htm (:tr (loop for i from 1 to 10
              do (htm (:td (if (eql i res)
                             (htm ((:input :type "radio" :name "res"
                                           :value i :checked)))
                             (htm ((:input :type "radio" :name "res"
                                           :value i)))))))))


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607