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

>
> def layout
>  layout_engine = Haml::Engine.new(IO.read("layout.haml"))
>  haml_concat layout_engine.render{ yield }
> end


Interesting experiment. I think it didn't work for you because the `layout
do ... end` block carried its context with it (remember closures) and when
it yielded, it still appended to the original template instead to
"layout.haml".

In my opinion, the only way this could work is that you use `haml_capture`
to capture the actual result and pass it in a block to
`layout_engine.render`. Yeah, falling back to raw strings doesn't seem
elegant, but it might be the only solution here. I'm pretty much convinced
that's how it works in Rails views, for instance.

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