;; RSS (defun rss () (cl-who:with-html-output-to-string (s nil :prologue "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>") (:rss :version "2.0" :|xmlns:atom| "http://www.w3.org/2005/Atom" (:channel (:title "An Origami Gallery") (:link "http://origamigallery.net") (:|atom:link| :href "http://origamigallery.net/feed" :rel "self" :type "application/rss+xml") (:description "A photo gallery. Of origami models.") (loop for model in (all-models) do (htm (:item (:title (str (fullname model))) (:link (str (absolute-url model))) (:guid (str (absolute-url model))) (:description (str (clean-remarks (remarks model)))))))))))
There are other Common Lisp libraries to make RSS feeds, which may have made this even easier, but I like CL-WHO.
Interesting about this code is how short it is. CL-WHO is an example of embedding another language in Common Lisp (e.g. a domain specific language), in this case, XML or HTML.
XML in particular happens to map very nicely onto s-expressions, allowing nested tags and attribute/value pairs and whatnot. Except that s-exps are far less verbose than XML, far nicer to type, and far easier to read in my opinion. One quirk here is that CL-WHO uses keyword symbols for XML tag names (CL keyword symbols begin with a colon), and XML uses colons for namespaces. To make a keyword symbol with a colon in the middle in CL, you have to surround it in pipes. No big deal though.
This kind of thing isn't entirely possible or quite as elegant in most other languages. (Ruby does pretty good though.) In PHP, for example, you can mix up PHP and HTML content, but the PHP interpreter doesn't parse the HTML or do anything interesting with it. It just treats it as a bunch of strings; embedding PHP in HTML is just a shortcut for string concatenation.
You could write a library in PHP to generate XML code (and I'm sure such libraries exist) but they're either going to have some kind of functional / OO interface, which will make it very verbose and probably clunky to use in comparison to CL, or else it's going to be something like Smarty which actually isn't PHP at all but rather a separate language with its own parser and interpreter or compiler that itself happens to be written in PHP. What you could not easily do is write PHP code that turns other PHP code into an XML document.
But that's largely what CL-WHO does. Because CL-WHO parses the s-exps that represent my XML data, if I forget a closing paren, Lisp will yell at me, so my XML is guaranteed to be well-formed. CL-WHO doesn't verify that I'm using proper RSS tags in the proper places or anything but it could easily be extended to do that. See PCL for an HTML interpreter/compiler which can verify that you only use valid HTML tags, for example.
CL-WHO also lets me change whether my XML attribute values are in single or double quotes, or whether I want to allow empty tags (as in old HTML) or require them all to be closed, and other such things. CL-WHO can nicely indent my XML, or generate it unindented.
And since this is all just Common Lisp, you see that I can embed a loop right in the middle of the XML s-exps, or do conditionals, or I could write a function that generates some or all these s-exps for me programatically. Or any number of other things. I have all of Common Lisp at my fingertips to create these s-exps.
See also "The Nature of Lisp" which is a nice long discussion of how Lisp is a better XML than XML. (And I do mean looong. I haven't read the whole article myself, but enough to know it's pretty good.)