From: Daniel Leidert <dleidert@debian.org>
Date: Wed, 25 Jan 2023 23:50:08 +0100
Subject: Fix syntax for ruby-haml 6

The interface of 'Haml::Engine' is changed in version 6:
* before: 'Haml::Engine.new("%p Haml code!").render'
* after:  'Haml::Template.new { "%p Haml code!" }.render'

https://github.com/haml/haml/blob/v6.1.1/CHANGELOG.md?plain=1#L90-L92

Bug-Debian: https://bugs.debian.org/1005631
Forwarded: no
---
 handlebars_assets.gemspec                    | 2 +-
 lib/handlebars_assets/handlebars_template.rb | 2 +-
 test/handlebars_assets/hamlbars_test.rb      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/handlebars_assets.gemspec b/handlebars_assets.gemspec
index 2b51658..1038d9c 100644
--- a/handlebars_assets.gemspec
+++ b/handlebars_assets.gemspec
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
   s.add_runtime_dependency "sprockets", ">= 2.0.0"
 
   s.add_development_dependency "minitest", '~> 5.5'
-  s.add_development_dependency "haml", '~> 4.0'
+  s.add_development_dependency "haml", '~> 6.0'
   s.add_development_dependency "rake", '~> 10.0'
   s.add_development_dependency "slim", '~> 3.0'
   s.add_development_dependency "appraisal"
diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb
index 17f2e83..d55a5b1 100644
--- a/lib/handlebars_assets/handlebars_template.rb
+++ b/lib/handlebars_assets/handlebars_template.rb
@@ -103,7 +103,7 @@ module HandlebarsAssets
 
     def choose_engine(data)
       if @template_path.is_haml?
-        Haml::Engine.new(data, HandlebarsAssets::Config.haml_options)
+        Haml::Template.new(HandlebarsAssets::Config.haml_options) { data }
       elsif @template_path.is_slim?
         Slim::Template.new(HandlebarsAssets::Config.slim_options) { data }
       else
diff --git a/test/handlebars_assets/hamlbars_test.rb b/test/handlebars_assets/hamlbars_test.rb
index 74a9560..757ceb3 100644
--- a/test/handlebars_assets/hamlbars_test.rb
+++ b/test/handlebars_assets/hamlbars_test.rb
@@ -6,7 +6,7 @@ module HandlebarsAssets
     include CompilerSupport
 
     def compile_haml(source)
-      (Haml::Engine.new(source, HandlebarsAssets::Config.haml_options).render).chomp
+      (Haml::Template.new(HandlebarsAssets::Config.haml_options) { source }.render).chomp
     end
 
     def setup
