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
, or class
is 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:
%body
#header
%h1 Bob Loblaw's Law Blog
%h2 by Bob Loblaw
#content
- @entries.each do |entry|
.entry
%h3.title= entry.title
%p.date= entry.posted
#footer
%p
All content copyright © Bob Loblaw.
This becomes something like:
<div id='header'>
<h1>Bob Loblaw's Law Blog</h1>
<h2>by Bob Loblaw</h2>
</div>
<div id='content'>
<div class='entry'>
<h3 class='title'>You don't need double-talk; you need Bob Loblaw</h3>
<p class='date'>Tuesday, October 31, 2006</p>
</div>
<div class='entry'>
<h3 class='title'>Why should you go to jail for a crime someone else noticed?</h3>
<p class='date'>Friday, August 11, 2006</p>
</div>
</div>
<div id='footer'>
<p>
All content copyright © Bob Loblaw.
</p>
</div>