8. ERB / RHTML
<?xml version='1.0' encoding='utf-8' ?>
!!! XML
<!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot;
!!! Strict
%html{html_attrs} quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;>
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Yet Another Rails Blog</title>
</head>
<body>
<div id='container'>
<div id='navigation'>
<%= link_to 'Home', root_path %>
</div>
<div id='content'>
<% @posts.each do |post| -%>
<div class='post'>
<h3><%= h post.title %></h3>
<strong>by: <%= post.author %></strong>
<p><%= post.body %></p>
</div>
<% end %>
</div>
</div>
</body>
</html>
9. ERB / RHTML
<?xml version='1.0' encoding='utf-8' ?>
!!! XML
<!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot;
!!! Strict
%html{html_attrs} quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;>
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
%head
<head>
%title Yet Another Rails Blog
<title>Yet Another Rails Blog</title>
%body
</head>
<body>
<div id='container'>
<div id='navigation'>
<%= link_to 'Home', root_path %>
</div>
<div id='content'>
<% @posts.each do |post| -%>
<div class='post'>
<h3><%= h post.title %></h3>
<strong>by: <%= post.author %></strong>
<p><%= post.body %></p>
</div>
<% end %>
</div>
</div>
</body>
</html>
10. ERB / RHTML
<?xml version='1.0' encoding='utf-8' ?>
!!! XML
<!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot;
!!! Strict
%html{html_attrs} quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;>
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
%head
<head>
%title Yet Another Rails Blog
<title>Yet Another Rails Blog</title>
%body
</head>
<body>
#container
<div id='container'>
#navigation
<div id='navigation'>
= link_to('Home', root_path)
<%= link_to 'Home', root_path %>
</div>
<div id='content'>
<% @posts.each do |post| -%>
<div class='post'>
<h3><%= h post.title %></h3>
<strong>by: <%= post.author %></strong>
<p><%= post.body %></p>
</div>
<% end %>
</div>
</div>
</body>
</html>
11. Hamlified!
<?xml version='1.0' encoding='utf-8' ?>
!!! XML
<!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot;
!!! Strict
%html{html_attrs} quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;>
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
%head
<head>
%title Yet Another Rails Blog
<title>Yet Another Rails Blog</title>
%body
</head>
<body>
#container
<div id='container'>
#navigation
<div id='navigation'>
= link_to('Home', root_path)
<%= link_to 'Home', root_path %>
</div>
#content
<div id='content'>
<%@posts.each do |post| -%>
- @posts.each do |post|
.post
<div class='post'>
<h3><%=h(post.title) %></h3>
%h3= h post.title
<strong>by:quot;by: post.author %></strong>
%strong= <%= #{h(post.author)}quot;
<p><%=post.body %></p>
%p= post.body
</div>
<% end %>
</div>
</div>
</body>
</html>
12. Haml Deconstructed
!!! XML
!!! Strict
%html{html_attrs}
%head
%title Yet Another Rails Blog
%body
#container
#navigation
= link_to('Home', root_path)
#content
- @posts.each do |post|
.post
%h3= h(post.title)
%strong= quot;by: #{h(post.author)}quot;
%p= post.body
13. Haml Deconstructed
XHTML document type
!!! XML
!!! Strict
%html{html_attrs}
%head
%title Yet Another Rails Blog
%body
#container
#navigation
= link_to('Home', root_path)
#content
- @posts.each do |post|
.post
%h3= h(post.title)
%strong= quot;by: #{h(post.author)}quot;
%p= post.body
14. Haml Deconstructed
XHTML document type
!!! XML
XHTML tag with !!! Strict
static content %html{html_attrs}
%head
%title Yet Another Rails Blog
%body
#container
#navigation
= link_to('Home', root_path)
#content
- @posts.each do |post|
.post
%h3= h(post.title)
%strong= quot;by: #{h(post.author)}quot;
%p= post.body
15. Haml Deconstructed
XHTML document type Haml helper method
!!! XML
XHTML tag with !!! Strict
static content %html{html_attrs}
%head
%title Yet Another Rails Blog
%body
#container
#navigation
= link_to('Home', root_path)
#content
- @posts.each do |post|
.post
%h3= h(post.title)
%strong= quot;by: #{h(post.author)}quot;
%p= post.body
16. Haml Deconstructed
XHTML document type Haml helper method
!!! XML
XHTML tag with !!! Strict
static content %html{html_attrs}
%head
%title Yet Another Rails Blog
DIV tag with ID %body
#container
#navigation
= link_to('Home', root_path)
#content
- @posts.each do |post|
.post
%h3= h(post.title)
%strong= quot;by: #{h(post.author)}quot;
%p= post.body
17. Haml Deconstructed
XHTML document type Haml helper method
!!! XML
XHTML tag with !!! Strict
static content %html{html_attrs}
%head
%title Yet Another Rails Blog
DIV tag with ID %body
#container
#navigation
= link_to('Home', root_path)
Execute Ruby code #content
- @posts.each do |post|
.post
%h3= h(post.title)
%strong= quot;by: #{h(post.author)}quot;
%p= post.body
18. Haml Deconstructed
XHTML document type Haml helper method
!!! XML
XHTML tag with !!! Strict
static content %html{html_attrs}
%head
%title Yet Another Rails Blog
DIV tag with ID %body
#container
#navigation
= link_to('Home', root_path)
Execute Ruby code #content
- @posts.each do |post|
.post
%h3= h(post.title)
XHTML tag with %strong= quot;by: #{h(post.author)}quot;
%p= post.body
dynamic content