Subject: Re: Pretty-printing HTML with HTMLgen?
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 28 Jun 2004 05:04:07 -0500
Newsgroups: comp.lang.lisp
Message-ID: <J8ydnTNzeq2KcELdRVn-vg@speakeasy.net>
Steven M. Haflich <smh_no_spiced_ham@alum.mit.edu> 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

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607