From gackle at shaw.ca Thu Dec 21 06:01:41 2006 From: gackle at shaw.ca (Daniel Gackle) Date: Wed, 20 Dec 2006 23:01:41 -0700 Subject: [cl-who-devel] Factoring out subtrees Message-ID: <0JAM00E7Y0SJGBD0@l-daemon> Hi, I have a really elementary question. I'm generating html that has stuff duplicated in it, like the link tag in this example: (defun page1 () (with-html-output-to-string (*standard-output*) (:html (:head (:link :rel "stylesheet" :type "text/css" :href "style.css")) (:body "hi")))) (defun page2 () (with-html-output-to-string (*standard-output*) (:html (:head (:link :rel "stylesheet" :type "text/css" :href "style.css")) (:body "there")))) How do I eliminate it? Is there a way to do the following? (defun page1 () (with-html-output-to-string (*standard-output*) (:html (:head (css-me-up "style.css")) (:body "hi")))) More generally, I'd like to build html trees and transform them in various ways before passing them to the generator. It feels like there must be an obvious answer here, but I'm missing it... so I'm asking y'all instead. Thanks, Dan From edi at agharta.de Thu Dec 21 07:51:44 2006 From: edi at agharta.de (Edi Weitz) Date: Thu, 21 Dec 2006 08:51:44 +0100 Subject: [cl-who-devel] Factoring out subtrees In-Reply-To: <0JAM00E7Y0SJGBD0@l-daemon> (Daniel Gackle's message of "Wed, 20 Dec 2006 23:01:41 -0700") References: <0JAM00E7Y0SJGBD0@l-daemon> Message-ID: On Wed, 20 Dec 2006 23:01:41 -0700, Daniel Gackle wrote: > Hi, I have a really elementary question. I'm generating html that > has stuff duplicated in it, like the link tag in this example: > > (defun page1 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (:link :rel "stylesheet" :type "text/css" :href "style.css")) > (:body "hi")))) > > (defun page2 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (:link :rel "stylesheet" :type "text/css" :href "style.css")) > (:body "there")))) > > How do I eliminate it? Is there a way to do the following? > > (defun page1 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (css-me-up "style.css")) > (:body "hi")))) > > More generally, I'd like to build html trees and transform them in > various ways before passing them to the generator. It feels like > there must be an obvious answer here, but I'm missing it... so I'm > asking y'all instead. Maybe this one? http://weitz.de/cl-who/#convert-tag-to-string-list Cheers, Edi. From gackle at shaw.ca Thu Dec 21 22:28:09 2006 From: gackle at shaw.ca (Daniel Gackle) Date: Thu, 21 Dec 2006 15:28:09 -0700 Subject: [cl-who-devel] Factoring out subtrees In-Reply-To: Message-ID: <0JAN0042UADI1000@l-daemon> < Maybe this one? > Doh! Yes. I must have read that at some point. Thanks Edi, Dan -----Original Message----- From: Edi Weitz [mailto:edi at agharta.de] Sent: Thursday, December 21, 2006 12:52 AM To: Daniel Gackle Cc: cl-who-devel at common-lisp.net Subject: Re: [cl-who-devel] Factoring out subtrees On Wed, 20 Dec 2006 23:01:41 -0700, Daniel Gackle wrote: > Hi, I have a really elementary question. I'm generating html that > has stuff duplicated in it, like the link tag in this example: > > (defun page1 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (:link :rel "stylesheet" :type "text/css" :href "style.css")) > (:body "hi")))) > > (defun page2 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (:link :rel "stylesheet" :type "text/css" :href "style.css")) > (:body "there")))) > > How do I eliminate it? Is there a way to do the following? > > (defun page1 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (css-me-up "style.css")) > (:body "hi")))) > > More generally, I'd like to build html trees and transform them in > various ways before passing them to the generator. It feels like > there must be an obvious answer here, but I'm missing it... so I'm > asking y'all instead. Maybe this one? http://weitz.de/cl-who/#convert-tag-to-string-list Cheers, Edi. From gackle at shaw.ca Thu Dec 21 23:55:08 2006 From: gackle at shaw.ca (Daniel Gackle) Date: Thu, 21 Dec 2006 16:55:08 -0700 Subject: [cl-who-devel] Factoring out subtrees In-Reply-To: <0JAN0042UADI1000@l-daemon> Message-ID: <0JAN009FCE9EJS60@l-daemon> By the way, your last example on that page appears to be missing an angle bracket, as seen in the sample output after '0': ... I assume you need a (list ">") before (funcall body-fn body) in the final method? Dan -----Original Message----- From: cl-who-devel-bounces at common-lisp.net [mailto:cl-who-devel-bounces at common-lisp.net] On Behalf Of Daniel Gackle Sent: Thursday, December 21, 2006 3:28 PM To: cl-who-devel at common-lisp.net Subject: RE: [cl-who-devel] Factoring out subtrees < Maybe this one? > Doh! Yes. I must have read that at some point. Thanks Edi, Dan -----Original Message----- From: Edi Weitz [mailto:edi at agharta.de] Sent: Thursday, December 21, 2006 12:52 AM To: Daniel Gackle Cc: cl-who-devel at common-lisp.net Subject: Re: [cl-who-devel] Factoring out subtrees On Wed, 20 Dec 2006 23:01:41 -0700, Daniel Gackle wrote: > Hi, I have a really elementary question. I'm generating html that > has stuff duplicated in it, like the link tag in this example: > > (defun page1 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (:link :rel "stylesheet" :type "text/css" :href "style.css")) > (:body "hi")))) > > (defun page2 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (:link :rel "stylesheet" :type "text/css" :href "style.css")) > (:body "there")))) > > How do I eliminate it? Is there a way to do the following? > > (defun page1 () > (with-html-output-to-string (*standard-output*) > (:html > (:head (css-me-up "style.css")) > (:body "hi")))) > > More generally, I'd like to build html trees and transform them in > various ways before passing them to the generator. It feels like > there must be an obvious answer here, but I'm missing it... so I'm > asking y'all instead. Maybe this one? http://weitz.de/cl-who/#convert-tag-to-string-list Cheers, Edi. _______________________________________________ cl-who-devel site list cl-who-devel at common-lisp.net http://common-lisp.net/mailman/listinfo/cl-who-devel From edi at agharta.de Fri Dec 22 07:24:51 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 22 Dec 2006 08:24:51 +0100 Subject: [cl-who-devel] New release 0.6.3 (Was: Factoring out subtrees) In-Reply-To: <0JAN009FCE9EJS60@l-daemon> (Daniel Gackle's message of "Thu, 21 Dec 2006 16:55:08 -0700") References: <0JAN009FCE9EJS60@l-daemon> Message-ID: On Thu, 21 Dec 2006 16:55:08 -0700, Daniel Gackle wrote: > By the way, your last example on that page appears to be missing an > angle bracket Yes, thanks for the note. This release fixes that. Cheers, Edi.
1