

Lisp Web Templating - dualogy

Yay, after my first week of playing with Lisp I built something that I really like but for ye olde advanced hacker this is probably kiddy stuff.<p>http://www.roxority.com/roxbase/<p>Still, I'm so fond of this whole new world I have to announce this small step and (proclaim 'im-on-a-natural-high)<p>Back to more scientific/biz news / work! ^^
======
gibsonf1
Nice work. We've ended up working the other way with our application by
generating the html from lisp. The advantage for us being that we can use
macros (including extensive nesting) to build entire complex webpages from a
very small amount of code dynamically.

~~~
dualogy
Yeah I've seen this method around with CL-WHO and similar approaches. I like
the fact that this is one of the many things you can do with macros / s-exprs.

However, for HTML for some reason I wanna keep this out of my code base.
Artificial distinction, granted, and now my way I have "code" inside the
"template" rather than the "template" inside the "code". I guess I'm just used
to doing things this way. Even though I'd never hand over my HTML to an
external designer or even edit it in a visual design tool I wouldn't like
(with-html (:body (:head (title "Hello World" etc as my "GUI layer". I haven't
quite figured out why :)

Anyway, this was fun to write and for the time being will be my preferred way
of designing my web apps... ^^ thanks for stopping by though!

------
nertzy
It seems to me that Lisp-generated websites tend not to have valid HTML. I've
often wondered if there is something about Lisp that makes people averse to
valid HTML.

Are there easy ways in Lisp to make sure that you are outputting valid HTML?
Like good libraries for escaping text and making sure the proper tags are
closed the right ways?

Anyway it's not such a big deal since the sites work fine in browsers. It's
more of a passing observation, that really probably extends to other
programming languages as well. I just think that something about the structure
of Lisp makes HTML/XML feel sloppy and thus there is an unspoken bias towards
not worrying about it.

[http://validator.w3.org/check?uri=http%3A%2F%2Fwww.roxority....](http://validator.w3.org/check?uri=http%3A%2F%2Fwww.roxority.com%2Froxbase%2F&charset=%28detect+automatically%29&doctype=Inline&group=0)

[http://validator.w3.org/check?uri=http%3A%2F%2Fnews.ycombina...](http://validator.w3.org/check?uri=http%3A%2F%2Fnews.ycombinator.com%2Fitem%3Fid%3D197019&charset=%28detect+automatically%29&doctype=Inline&group=0)

~~~
dualogy
Nope, at least in my case the HTML is not Lisp-generated, but hand-written. I
use the templating way where occasionally I insert server-side Lisp code in
what is otherwise mostly mark-up.

Of course it is not "something about Lisp". The HTML is always generated by a
human, either "manually" (as in my template library) or automatically (as in
CL-WHO or home-grown s-expression-to-HTML macros).

But you're right, it's not a big deal. What matters is the browser and the
user, not the W3C :)

------
gills
Good Work. I have to second that what attracts me to Lisp/Scheme/Arc for the
web is being able to generate the page as s-expr's which are easily converted
to html.

------
gutzofter
Declaritive web programming. Works for me.

