HAML 0.2: The Bomb


I want to thank everyone for the tremendous response to HAML. I'm
absolutely amazed at the sheer number of sites that have switched over
to HAML. I am honestly shocked at the emails I get. This started as a
passion of mine and has grown into the passion of others. Special
thanks for this release goes to Nathan Wiesenbaum who gives new meaning
to prolific.

---THE DEAL---

After nearly a 90% code-base rewrite, we find our selves with a
new-and-improved HAML... codenamed The Bomb. And its features are ready
to *drop*!

We have many, many new features available including...

- Multi-class Handling
- Multi-single-lines with the - character.
- Blocks via Silent Scripting
- Proper Error Reporting

Read all about the new features at:


Or, just update your code off the haml trunk:


The README file is far more complete now and is almost a tutorial. So,
give that a read-through to find new features.


Exciting! I read the tantalizing apetizers on your blog and trac
site. Can't wait for the main course to be served. Will the trac
tutorial be expanded soon?

How does HAML handle if-else-then constructs? I use them to
selectively show menu options, for example.

<% if current_user.has_permission?('admin') %>
<%= link_to "admin menu", :controller => "admin", :action => "menu" %>
<% else %>
<%= link_to "normal menu", :controller => "welcome", :action => "menu" %>
<% end %>

Ok, thanks (or blames to) silent-scripting, you can convert this to...

- if current_user.has_permission?('admin')
  = link_to "admin menu", :controller => "admin", :action => "menu"
- else
  = link_to "normal menu", :controller => "welcome", :action => "menu"

But, my personal style-preference is doing this with menus.

File: _admin.haml
  = link_to "admin menu", :controller => "admin", :action => "menu"

File: _guest.haml
  = link_to "normal menu", :controller => "welcome", :action => "menu"

Then, do....

= render :partial => (current_user.has_permission?('admin') ? 'admin' :

Keeps it a little more D.R.Y. ... and obviously you usually have more
than a link-difference in a menu.

Though, that's a personal style-choice.

Then, back in your o

Thanks for the reply. And add a little bit more to my understanding,
how would a dropselect tag be written in HAML? Assuming:
lookup model = Service ( with id, and name)
Current model = Company[service_id]

Also, what is the best way to contact you about HAML, is there a
mailing list, or is posting to the RubyRails list the best place?

Thanks for your help.

Actually, we recently created a google-group called "haml"... so that's
the best place.

What kind of select tag do you mean? There are rails helpers for the
basic kinds, unless you have some specific need.


Nothing special. This is what I had in mind.
   <td><%= label_for 'model', 'attribute' %></td>
   <td><%= select 'model', 'attribute', @droplist %></td>

Is there a tutorial, and/or a reference for the HAML DSL someplace. I
didn't see anything an the plugin.

There is a file in the Haml trunk called "REFERENCE". Its also one of
the documents on the Haml google-group.

    %td= label_for :model, :attribute
    %td= select :model, :attribute, @droplist

That'd be the Haml for that.


Thanks for the sample and the reference. My somewhat jaded mind is
having a hard time accepting that HAML might just possibly be as easy
as it looks. These code samples help a lot.