Re:Welcome PyT. Python DSL for fast (X)HTML generation
by roguas on Friday December 07, 2012 @08:39AM
(#4886805)
a)if you are not, you should get or let someone else do it
b)right, this fits nice with forms... forms are not purely html issue, but a whole another layer of serverside complexity underneath...(escapes, xss, tokens)
c)argument against imo, if more people have to work on something more I am eager to use something common, standard...
Enlive is kind of like haml from what I see. For me its right on the border, I like it, I see the benefits but you have to take some leap and believe you wont hit the pit.
One other area where abstraction is appropriate is form generation. I've used Django a lot and recently Clojure+Noir a bit, and in both of those I've ended up using an abstraction for all the form code (Django forms in the former, Hiccup+helpers in the latter). In the Clojure project I was even working with someone knew HTML and not Clojure, so most of the site is rendered using Mustache templates, but I ended up rewriting all the forms in Hiccup because it's just easier to work with.
All that said, you seem like someone that might like Enlive (https://github.com/cgrand/enlive). I'm not sure if equivalents exist in other languages, but the gist of using it for templating is that you write a plain HTML file, and run the text through Enlive along with some transforms (identified by CSS-style selectors). I've never used it for anything major, but other people have, and it seems really cool.