public
Last active

ERB and Mustache side-by-side

  • Download Gist
gistfile1.rhtml
RHTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<h1><%= header %></h1>
<% if not item.empty? %>
<ul>
<% for i in item %>
<% if i[:current] %>
<li><strong><%= i[:name] %></strong></li>
<% else %>
<li><a href="<%= i[:url] %>"><%= i[:name] %></a></li>
<% end %>
<% end %>
</ul>
<% end %>
<% if item.empty? %>
<p>The list is empty.</p>
<% end %>
gistfile2.htm
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<h1>{{header}}</h1>
{{#list}}
<ul>
{{#item}}
{{#current}}
<li><strong>{{name}}</strong></li>
{{/current}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
{{/link}}
{{/item}}
</ul>
{{/list}}
{{#empty?}}
<p>The list is empty.</p>
{{/empty?}}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.