Idea: using code rather than templates to generate HTML
1–10 of 74 posts
Re: Idea: using code rather than templates to generate HTML
#2Anyway, the idea is simple: templates are a mess. They have goofy language variants, etc. Your editor can't color them. Why not just use code to generate the HTML?
Still needs: Context-sensitive escaping, css generation, javascript inclusion.
Re: Idea: using code rather than templates to generate HTML
#3Also, I agree. I'm using templates that are just python functions in my new Python web framework, Webify (http://github.com/jperla/webify/tree/master).
I honestly don't think I've made it clean enough though (there are a lot of yield's there). Nevertheless, I think I'm on the right track.
The only thing I'm not sure about is that the Django people seem to think that allowing designers to edit code the html directly should be allowed, and that they need a simple secure straightforward html template language. Pure Python obviously avoids that. I also kind of like the straightjacket of Python templates.
Re: Idea: using code rather than templates to generate HTML
#4http://docs.plt-scheme.org/continue/index.html#(part._.Rende...
Re: Idea: using code rather than templates to generate HTML
#5Re: Idea: using code rather than templates to generate HTML
#6The most known is probably Markaby, written by _why two years ago: http://redhanded.hobix.com/inspect/markabyForRails.html
Nokogiri also ships with a similar library, and Tagz is another one.
I've actually written such a library myself which uses ParseTree/RubyParser to parse the code and generates plain Ruby. Of course, nobody is ever going to use it, but it was a load of fun and it's super fast.
Re: Idea: using code rather than templates to generate HTML
#7Re: Idea: using code rather than templates to generate HTML
#8I've been sitting on this for a while and finally pushed it out, having never really had the chance to give the idea the work it deserves. Anyway, the idea is simple: templates are a mess. They have goofy language variants, etc. Your editor can't color them. Why not just use code to generate the HTML? Still needs: Context-sensitive escaping, css generation, javascript inclusion.
(Sorry; pet peeve. ;))