Haml は、空白インデントを用いてクリーンで重複のない(DRY)HTML マークアップを生成するテンプレートエンジンです。
基本構文
Doctype 宣言
!!!
!!! 5
!!! Strict
!!! Frameset
!!! Mobile
!!! Basic
タグと構造
%p Hello World
%span
Inner text
クラスと ID
%div#content
%p.highlighted Text content
/ Div is the default tag when omitted
.notice
#login-box
インライン属性
両方のハッシュ構文がサポートされています:
%html{ "xml:lang" => "en", :lang => "en" }
%a{ :href => "/login", :title => "Sign in" }
/ HTML-style attributes syntax
%a(href="/login" title="Sign in")
Ruby コードの評価
= "Evaluated Ruby expression"
- [1, 2, 3].each do |num|
%li= num