News for hackers. Stuff that matters.
Re:Making Wrong Code Look Wrong by rlpb on Monday August 22, 2011 @11:24AM (#2912730)
Taking this even further, an HTML templating system that involves supplying syntactic HTML as strings is fundamentally broken. Ideally you'd never provide a string that ends up as syntactic HTML. You'd build up a data structure that represents your output and a serializer would do the rest, escaping everything correctly since there would be a type-based distinction between HTML structure and element content. Genshi is an example of a templating system that works on data rather than syntactic string snippets.
Re:Making Wrong Code Look Wrong by perlgeek on Monday August 22, 2011 @11:30AM (#2912761)
Live isn't always that simple.

For example sometimes you get a piece of HTML that you have to include verbatimely for policital reasons (ad banners come to mind that need to be included character by character because of the Terms of Service - see AdSense for example).

In that case you really need an option for direct, unescaped HTML inclusion.

Or you might need to hilight the a syntax that's hard to parse, and the only available hilighter spits out HTML pieces instead of parse trees.

My point is that a template system should be able to deal with such realities, and it doesn't make it "fundamentally broken".

Re:Making Wrong Code Look Wrong by nasmorn on Monday August 22, 2011 @02:14PM (#2913425)
Also while you can build a company on the motto "People feeling uncomfortable with a HTML generation library have no business adding a list tag somewhere" there are certainly cases where it makes sense for them to do so.