haml / haml-rails

let your Gemfile do the talking
MIT License
1.04k stars 169 forks source link

Version 2.1 not including converters? #182

Closed cpanderson closed 1 year ago

cpanderson commented 1 year ago

Hello,

I'm trying to test an issue with Rails 7.0.4 and Action Text content not being properly parsed html safe. When I started a new project to create the test I installed haml-rails 2.1 but the erb/html converters don't work. Here's the Gemfile.lock entries...

haml (6.0.5)
      temple (>= 0.8.2)
      thor
      tilt
haml-rails (2.1.0)
  actionpack (>= 5.1)
  activesupport (>= 5.1)
  haml (>= 4.0.6)
  railties (>= 5.1)

With haml-rails 2.0...

haml (5.2.2)
      temple (>= 0.8.0)
      tilt
haml-rails (2.0.1)
  actionpack (>= 5.1)
  activesupport (>= 5.1)
  haml (>= 4.0.6, < 6.0)
  html2haml (>= 1.0.1)
  railties (>= 5.1)
hashie (5.0.0)
html2haml (2.2.0)
  erubis (~> 2.7.0)
  haml (>= 4.0, < 6)
  nokogiri (>= 1.6.0)
  ruby_parser (~> 3.5)

As you can see it didn't install the html2haml gem that provides the erb converters, I'm assuming. If this is an additional step now please update the README otherwise it will need fixing.

It seems to work if I add the the gem manually after installing 2.1

Thanks!

cpanderson commented 1 year ago

Update: the html2haml gem that's installed for 2.1 is broken as well. The converter doesn't parse the application erb layout file properly. Have to go back to 2.0.1 to resolve but may not parse action text content properly in Rails 7.0.4

amatsuda commented 1 year ago

@cpanderson html2haml is no longer a dependency of haml-rails since https://github.com/haml/haml-rails/pull/133, and this patch was included in haml-rails 2.1.0 which includes Haml 6 support as well https://github.com/haml/haml-rails/pull/180. Therefore, if you need to bundle html2haml in your application with Haml 6, you have to manually put "html2haml" dependency in your application's Gemfile.

However, the released version of html2haml was not supporting Haml 6 at the time you filed this issue (thank you for letting us know this). I just published html2haml version 2.3.0 that supports Haml 6 https://github.com/haml/html2haml/pull/91.

Now that all related gems for Haml 6 are released, your gem versions problem should be solved by running bundle u haml-rails html2haml. And if you're still seeing the breakage in the parse result in your application, please file an issue with a haml template that can reproduce the problem. Thanks!

cpanderson commented 1 year ago

Ok thanks. I've created a pull request so the README reflects that.