Try = yield

As you want to output the result of the yield.

Cheers
Alex

Sent from my iPad

On May 2, 2010, at 2:15 PM, Don <[email protected]> wrote:

> I have been working on a little project and am having trouble figuring
> out how yield is supposed to behave in templates.  Here is a little
> bit of code that I thought should work.
> 
> def layout
>  layout_engine = Haml::Engine.new(IO.read("layout.haml"))
>  haml_concat layout_engine.render{ yield }
> end
> 
> engine = Haml::Engine.new(IO.read("index.html.haml"))
> puts engine.render
> 
> ---------index.html.haml------------
> %h1 Before the container
> - layout do
>  %h1 Inside the container.
> 
> ------------layout.haml------------
> #container
>  - yield
> 
> ------------Output------------
> <h1>Before the container</h1>
> <h1>Inside the container.</h1>
> <div id='container'>
> </div>
> 
> 
> It puts both h1 tags before the container div rather than one before
> and one inside.  I looked through the haml source and also the
> staticmatic source, but couldn't find what I'm doing wrong.  I really
> appreciate any help anyone might have to offer.
> 
> Don
> 
> -- 
> 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.
> 

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