5 ms·
One templating approach that takes HTML's tree structure more seriously is Haml. Its syntax (mostly) enforces valid output, so you don't have to worry about clo
by pjungwir 13y ago
One templating approach that takes HTML's tree structure more seriously is Haml. Its syntax (mostly) enforces valid output, so you don't have to worry about closing/matching tags etc. This also makes it very concise, and (since its indentation matches the HTML tree) extremely easy to scan & read. It's basically a DSL optimized for markup trees like HTML.
Composing a DOM by instantiating objects for each node sounds awful, but I think you're right that flat plain-text templates miss an opportunity to leverage HTML's tree-like structure. Haml does a great job exploiting that structure.