Is there a language I can use to write my website’s HTML, which:
- converts to HTML without having to write the HTML directly
- has all the power of HTML
- is less verbose than HTML and XML
For example, it should be to HTML what CoffeeScript is to JS.
Also, what is your experience with whatever you suggest?
Also have a look at Comparison of web template engines and Scala Tags
A good choice is Haml. In Haml, you write highly structured markup that resembles a stripped-down form of HTML, and where common things have easy shortcuts. For example, adding an element,
div,id, orclassis done just by changing one character.It even lets you pass variables in and operate on them in the language of your choice by deferring to a scripting language, so it’s actually more powerful than HTML since the implicit scripting makes it Turing-complete.
Here’s an example:
This becomes something like: