Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Haml 6 #1820

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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