For that example, the right way to do it would be to do...

#bar{:style => "foo"} Narf

If you notice you are getting really long attribute lines, then
something is going awry. Find another way to not *need* that many
lines. See if you can use a block in a helper to get around this.

- bar do
  Narf

--IN THE HELPER

# This is using the prototype open_tag syntax.
# This may not be official for long, but there are lots of ways to handle this.
def bar(&block)
  open_tag :div, :style => "foo",
                       :id     => "bar",
                       &block
end

That will wrap it all in a div and give you a nice way to give many attributes.

Remember, Haml is for structure. Keep it structural and you will keep it pretty.

-hampton

On 3/15/07, Nex3 <[EMAIL PROTECTED]> wrote:
>
> The pipe character is, in fact, how you'd do it. For example,
>
> %div{:style => "foo", |
>      :id => "bar}     |
>   narf
>
> Keep in mind that you need pipe characters on *every* line in the
> multiline sequence, including the last one.
>
> - Nathan
>
> On Mar 15, 3:28 am, "ridcully" <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I find myself often in the situation, where the hash with the
> > attributes for an element contains many long elements. For my personal
> > viewing pleasure I want to be able to distribute the hash over
> > multiple lines.
> >
> > For example:
> >
> > %div{:style => "foo", :id => "bar"}
> >   narf
> >
> > Becomes
> >
> > %div{:style => "foo",
> >   :id => "bar"}
> >   narf
> >
> > I cannot figure out how to do this respectively is this even possible?
> > I tried intending and using the pipe character.
> >
> > Thanks
> > andi
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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