Brad's comments on the world of technology...

HTML from lisp

(aside: this is a pretty funny intro to lisp casting spels in lisp)

Generating HTML from lisp is nothing new. Many people have done it and there are lots projects on the web using it. There's also a lot of interesting XML/HTML lisp code floating around. It turns out that XML and HTML lend themselves rather well to symbolic processing.

I've recently been frustrated writing and maintaining html web pages. So, I thought I'd try an experiment. I modified a simple scheme based http server, placed it behind a caching apache2 server. These are ideas I got while looking at Hunchentoot and TBNL. It seems you can make a pretty robust and quick web server with SBCL and these tools. I also like this package (htout).

My needs are more simplistic, and I'm lazy, so I used scheme (siod). I took my old html web pages and extracted out the boiler-plate from the content. The I wrote some translation code which would generate HTML from lisp s-expressions. This translation takes several steps as I implemented some simple macros to make my life easier (common things like anchors in side a list element for example).

It only took a few days and I had parity with my old pages and found the new "content only, lispy style" pages much easier to read and edit.

Here's an example of one of the pages from This pages as a standard look and style sheet as well as standard navigation but all of that is hidden. I can use all of html, but I get to use nice s-expression which are much easier to navigate (for me) than the XML syntax.

;; $Id$
 :title "Various Lisp Machine Keyboards"
 :start "Various Lisp Machine Keyboards"
   (p "These some pictures of various Lisp Machine keyboards.  I don't have
any documentation on the actually keys (yet).")

   (h2 "CADR")

    (li-url ""
    (li-url ""

   (h2 "Symbolics")

    (li-url "/keyboards/symbolics.gif"
    (li-url "/keyboards/DSC_2077-small.jpg"
	    "Symbolics 3600 keyboard")
    (li-url "/keyboards/keyboard_6074.jpg" 
	    "Symbolics keyboard (PN 365407 Rev C)"))


I'm pretty happy with this an plan to redo all my pages. Worst case I can always generate raw html and go back to the old way. Best case I can continue to leverage lisp and make better and more interesting (and active) pages.

Tags :