Haml è un template engine per HTML che utilizza l'indentazione per produrre markup pulito e senza ripetizioni (DRY).
Concetti di base
Doctype
!!!
!!! 5
!!! Strict
!!! Frameset
!!! Mobile
!!! Basic
Tag e struttura
%p Hello World
%span
Inner text
Classi e ID
%div#content
%p.highlighted Text content
/ Div is the default tag when omitted
.notice
#login-box
Attributi inline
Entrambe le sintassi hash sono supportate:
%html{ "xml:lang" => "en", :lang => "en" }
%a{ :href => "/login", :title => "Sign in" }
/ HTML-style attributes syntax
%a(href="/login" title="Sign in")
Valutazione codice Ruby
= "Evaluated Ruby expression"
- [1, 2, 3].each do |num|
%li= num