Upgrading to Haml 5.0 removes dynamic quote support leading to parsing error by Nokogiri

Viewed 82

Created this issue in the Haml github: https://github.com/haml/haml/issues/1023

Upgrading to Haml 5.0 is causing changes due to removal of dynamic quotes functionality

For example, if I were to use Nokogiri to parse the following haml (where "..." is another partial)

%a.nav{:"data-content" => render ... }

I get

<a class='nav' data-content='<div id='...'>' >

When what I wanted was

<a class='nav' data-content="<div id='...'>" >

Running

Nokogiri::HTML.fragment("<a class='nav' data-content='<div id='...'>'>")

Gives me

#(Attr:0x3f7ea6e9adcc { name = "data-content", value = "<div id=" })

Running

Nokogiri::HTML.fragment("<a class='nav' data-content=\"<div id='...'>\">")

Gives me back

#(Attr:0x3f7ea6c0b4e4 { name = "data-content", value = "<div id='...'>" })

It seems that removal of dynamic quote functionality has affected the ability to parse through the HTML output. Is there a way to re-enable dynamic quoting, or to fix the issue some other way?

1 Answers
Related