Haml est un moteur de templates pour HTML utilisant l'indentation par espaces afin de produire un balisage propre et DRY.
Bases
Doctype
!!!
!!! 5
!!! Strict
!!! Frameset
!!! Mobile
!!! Basic
Balises et structure
%p Hello World
%span
Inner text
Classes et identifiants
%div#content
%p.highlighted Text content
/ Div is the default tag when omitted
.notice
#login-box
Attributs en ligne
Les deux syntaxes de hachage sont prises en charge :
%html{ "xml:lang" => "en", :lang => "en" }
%a{ :href => "/login", :title => "Sign in" }
/ HTML-style attributes syntax
%a(href="/login" title="Sign in")
Évaluation Ruby
= "Evaluated Ruby expression"
- [1, 2, 3].each do |num|
%li= num