Skip to content

Commit

Permalink
Merge pull request #1820 from sinatra/haml-6
Browse files Browse the repository at this point in the history
Support Haml 6
  • Loading branch information
jkowens authored Sep 27, 2022
2 parents 2b659be + 684a1c0 commit b8529e2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sinatra-contrib/lib/sinatra/capture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module Capture
def capture(*args, &block)
return block[*args] if ruby?

if haml? && Tilt[:haml] == Tilt::HamlTemplate
if haml? && Tilt[:haml] == Tilt::HamlTemplate && defined?(Haml::Buffer)
buffer = Haml::Buffer.new(nil, Haml::Options.new.for_buffer)
with_haml_buffer(buffer) { capture_haml(*args, &block) }
else
Expand Down
2 changes: 1 addition & 1 deletion sinatra-contrib/lib/sinatra/content_for.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def clear_content_for(key)
# for <tt>:head</tt>.
def yield_content(key, *args, &block)
if block_given? && !content_for?(key)
haml? && Tilt[:haml] == Tilt::HamlTemplate ? capture_haml(*args, &block) : yield(*args)
haml? && Tilt[:haml] == Tilt::HamlTemplate && respond_to?(:capture_haml) ? capture_haml(*args, &block) : yield(*args)
else
content = content_blocks[key.to_sym].map { |b| capture(*args, &b) }
content.join.tap do |c|
Expand Down
2 changes: 1 addition & 1 deletion sinatra-contrib/sinatra-contrib.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RubyGems 2.0 or newer is required to protect against public gem pushes. You can
s.add_development_dependency 'asciidoctor'
s.add_development_dependency 'builder'
s.add_development_dependency 'erubi'
s.add_development_dependency 'haml', '~> 5'
s.add_development_dependency 'haml'
s.add_development_dependency 'liquid'
s.add_development_dependency 'markaby'
s.add_development_dependency 'nokogiri'
Expand Down
2 changes: 1 addition & 1 deletion sinatra-contrib/spec/content_for/passes_values.haml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
= yield_content :foo, 1, 2
!= yield_content :foo, 1, 2

0 comments on commit b8529e2

Please sign in to comment.