[cl-who-devel] Factoring out subtrees

Daniel Gackle gackle at shaw.ca
Thu Dec 21 06:01:41 UTC 2006


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






More information about the Cl-who-devel mailing list