CL HTML template languages
Tuesday, October 12, 2004
If you want to programmatically generate HTML using CL, you basically either:
- Generate the HTML from in CL using a Lisp Markup Language OR
- Embed Lisp in HTML using an HTML template language
"Here are a few that i've tried, and my observations and opinions.For people who want a Scheme-based HTML template language, BRL is supposed to be pretty good.
Similar to smarty or HTML::Mason. This is what i think of when i want a template toolkit. Like most lisp template engines, can embed either lisp forms or a mini-language.
Similar to the perl module of the same name. Uses tags embedded in HTML comments (although is not HTML specific). Its available with debian (which is a plus), so it was the first one i tried.
TAL: (part of yaclml) http://common-lisp.net/project/bese/yaclml.html
TAL was created as part of the zope project, and has been implemented is serveral language. it uses XML attributes to manipulate the templates. the advantage of this approach is that your templates are valid XML, and can be used by your designers using their tools. I've been using TAL lately as part of UncommonWeb, a Web application framework. It's really easy to extend, and your extensions can manipulate the XML source of the template, which allows for some really neat solutions to common web programming problems.
I've never used this, as it's a jsp/php type approach, which i personally disdain. But, it offers a great example of how to get started writing your own template language in lisp. I personally use cl-emb, but i have been playing with TAL a lot lately. Whichever you choose depends mostly on your needs.
There is also CLP, which comes as part of allegros webactions package. I've not had much experience with this either, but it's another option."