Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

October 2004
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Sep  Nov

CL HTML template languages

Tuesday, October 12, 2004

If you want to programmatically generate HTML using CL, you basically either:

I've never much cared for HTML template languages like JSP. I don't even like the CL equivalents; however, for some types of applications, they can be appropriate options. On c.l.l., drewc provides a good summary of the CL HTML template languages that are available:
"Here are a few that i've tried, and my observations and opinions.

cl-emb: http://common-lisp.net/project/cl-emb/examples.html

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.

HTML-TEMPLATE: http://www.cliki.net/HTML-TEMPLATE

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.

LSP: http://lemonodor.com/archives/000128.html

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.

CLP: http://opensource.franz.com/aserve/aserve-dist/webactions/doc/webactions.html

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."
For people who want a Scheme-based HTML template language, BRL is supposed to be pretty good.

emacs Copyright © 2004 by Bill Clementson