k0kubun / hamlit

High Performance Haml Implementation
https://rubygems.org/gems/hamlit
Other
981 stars 59 forks source link

Sinatra content_for throws an error when using hamlit #150

Closed drum445 closed 4 years ago

drum445 commented 4 years ago

Hello, Latest sinatra Latest hamlit

When using sinatra's yield_content helper I get the following error: undefined method with_haml_buffer' for #

Example code: layout.haml

!!!
%html
  %head
    %title== MySite | #{yield_content :title}
  %body
    .container
      != yield

home.haml

- content_for(:title, "Home")

%h3 Home page content

Hopefully it's clear what I'm trying to do. Please let me know if I shouldn't be using sinatra's yield_content helper and if hamlit has its own. FYI, it works as expected when using normal haml.

Many Thanks

k0kubun commented 4 years ago

sinatra-contrib's yield_content implementation has not supported Hamlit yet. I implemented that in https://github.com/sinatra/sinatra/pull/1580. Please use my fork for the time being. By the nature of sinatra-contrib implementation, you may also need to use hamlit-block.gem if you're using capturing with a block.

Let me close this issue because I have nothing to do on my side.