nex3 edited this page Sep 13, 2010 · 5 revisions
Clone this wiki locally


herml is an Erlang port of Haml. It intends to appropriate the primary features of Haml while adhering to Erlang conventions where appropriate. What is taken from Haml:

  • Space-sensitivity – using 2 spaces for nesting of tags and blocks
  • ID and class shortcuts for elements
  • DOCTYPE shortcuts
  • Trailing slash (/) for singleton “self-closed” tags
  • Some default helpers, including html_attrs and escape_once

Where Erlang conventions are applied:

  • Tag attributes are expressed as proplists
  • Iteration is done with a list-comprehension-like syntax

Ways in which herml is different:

  • Emitting variables from the environment or calling helper functions is done by preceding the variable or function with “@”.
  • Since the template cannot have instance variables in the same sense as Haml, function calls preceded with @@ will receive the current environment proplist as the last argument.

We also take the stand that templates should be accompanied by a rich set of helpers to reduce the amount of code in the template. As such we do not intend to allow nested function calls.