Oh well...

it does not work.

this helper:
def round_corners
  "<div class='rc'>#{yield}</div>"
end

this haml:
= round_corners do
  %span some text

renders this html:
  <span>some text</span>
  <div class='rc'>false</div>


I tried variations on yield.to_s, and using a block parameter ... couldn't
find something that works.


Help again please ......


Thank you!




On 5/11/07, Evgeny <[EMAIL PROTECTED]> wrote:
>
> Yey! So all I was missing is the "do"! :)
> Thanks!
>
> My example for a helper was written in the mail body, not copied there ...
> so I guess I wrote something that should not work, sorry. The actual helper
> has different div tags.
>
>
> Thank you again!!
>
> Now I'll be off DRYing my code ....
>
> all those round corners everywhere taking 6 lines of haml will not take 1
> !
>
>
> Yey! :)
>
> Regards,
>
> - evgeny
>
> On 5/11/07, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> >
> >  The reason it's breaking is that you aren't actually passing it a
> > block. What you're looking for is
> >   = round_corner do
> >     %span Some text
> > Also, your helper produces invalid HTML. A closing tag can't have
> > attributes.
> >
> > - Nathan
> >
> > Evgeny wrote:
> >
> > Greetings Haml users,
> >
> > I tried to write a simple helper method that will use a block to put
> > haml content inside.
> >
> > The divs are a little bit more compilcated, but what it does is this :
> > def round_corner
> >   "<div class='top_rc'>#{yield}</div class='bottom_rc'>"
> > end
> >
> >
> > And the Haml code to go with it:
> >
> >   = round_corner
> >     %span Some text
> >
> >
> >
> > Any idea why it would throw an error and not work?
> >
> > (using haml stable)
> >
> >
> > Regards,
> >
> >
> > - evgeny
> >
> >
> >
> >
> > > >
> >
>

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