HTML isn't meant to handle presentation. Ideally, it's a way of marking up content to allow an arbitrary presentation layer to be laid on top.
I prefer generating HTML content through s-expressions. It's more flexible and concise than a templating library, and it forces you to bear in mind the separation of content and presentation. In turn, this makes it easier to unit-test the views, and to write automated integration tests.
For instance, if I were a designer writing a template, I have control over both the CSS and the HTML. This might tempt me to write the HTML around a particular design:
But if I am a programmer, without necessarily much knowledge of the presentation, I might be more careful to write more semantic HTML that's presentation-neutral.
I prefer generating HTML content through s-expressions. It's more flexible and concise than a templating library, and it forces you to bear in mind the separation of content and presentation. In turn, this makes it easier to unit-test the views, and to write automated integration tests.
For instance, if I were a designer writing a template, I have control over both the CSS and the HTML. This might tempt me to write the HTML around a particular design:
But if I am a programmer, without necessarily much knowledge of the presentation, I might be more careful to write more semantic HTML that's presentation-neutral. Which has the useful side effect of making it easier to write tests: