Hello all, I started using HAML today. I want to convert this 9 lines
chunk of .html.erb into HAML

<p><%= f.label :name           %><%= f.text_field :name           %></
p>
<p><%= f.label :address        %><%= f.text_field :address        %></
p>
<p><%= f.label :country        %><%= f.text_field :country        %></
p>
<p><%= f.label :contact        %><%= f.text_field :contact        %></
p>
<p><%= f.label :email          %><%= f.text_field :email          %></
p>
<p><%= f.label :uri, "URI"     %><%= f.text_field :uri            %></
p>
<p><%= f.label :phone          %><%= f.text_field :phone          %></
p>
<p><%= f.label :fax            %><%= f.text_field :fax            %></
p>
<p><%= f.label :purchase_order %><%= f.text_field :purchase_order %></
p>

I wish that this could be represented as:

%p= f.label :name          ; f.text_field :name
%p= f.label :address       ; f.text_field :address
%p= f.label :country       ; f.text_field :country
%p= f.label :contact       ; f.text_field :contact
%p= f.label :email         ; f.text_field :email
%p= f.label :uri, "URI"    ; f.text_field :uri
%p= f.label :phone         ; f.text_field :phone
%p= f.label :fax           ; f.text_field :fax
%p= f.label :purchase_order; f.text_field :purchase_order

But unfortunately that does not work. It looks like the semicolon is
not supported. Therefore, if I am to preserve the number od lines and
columns alignment, I am forced to do this:

%p== #{f.label :name}           #{f.text_field :name}
%p== #{f.label :address}        #{f.text_field :address}
%p== #{f.label :country}        #{f.text_field :country}
%p== #{f.label :contact}        #{f.text_field :contact}
%p== #{f.label :email}          #{f.text_field :email}
%p== #{f.label :uri, "URI"}     #{f.text_field :uri}
%p== #{f.label :phone}          #{f.text_field :phone}
%p== #{f.label :fax}            #{f.text_field :fax}
%p== #{f.label :purchase_order} #{f.text_field :purchase_order}

And if I want to get rid of all those extra braces, the I have to
triple the number of lines:

  %p
    = f.label :name
    = f.text_field :name
  %p
    = f.label :address
    = f.text_field :address
  %p
    = f.label :country
    = f.text_field :country
  %p
    = f.label :contact
    = f.text_field :contact
  %p
    = f.label :email
    = f.text_field :email
  %p
    = f.label :uri, "URI"
    = f.text_field :uri
  %p
    = f.label :phone
    = f.text_field :phone
  %p
    = f.label :fax
    = f.text_field :fax
  %p
    = f.label :purchase_order
    = f.text_field :purchase_order

So, in summary, I think that HAML is great but if I could use the
semicolon (or something similar)  it would be better.

Regards,

Gustavo Delfino
Caracas, Venezuela.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to