winton / stasis

Static sites made powerful
http://stasis.me
MIT License
677 stars 56 forks source link

Helpers with blocks #63

Closed Bastes closed 11 years ago

Bastes commented 12 years ago

Hi,

It've been trying to do something like this :

helpers do
  def embedding
    "<div>#{capture(yield)}</div>"
  end
end

And understood I was trying to do somethings rails-y when rails wasn't there.

Still, it would be really awesome to be able to do something like that to dry up all those messy repetitions in our e-mailings....

How do you think we could go about implementing it ?

Bastes commented 11 years ago

Found out it works with the proper syntax using haml. Sorry for the noise.

For those that would like to do it:

helpers do
  def embedding &block
    "<div>#{capture_haml(&block)}</div>"
  end
end