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

More than one ERB string interpolation in HTML attribute #85

Open
marcoroth opened this issue Feb 6, 2023 · 1 comment
Open

More than one ERB string interpolation in HTML attribute #85

marcoroth opened this issue Feb 6, 2023 · 1 comment

Comments

@marcoroth
Copy link
Owner

ERB Input:

<div style="<%= "background: red;" %><%= "display: block;" %>"></div>

Output:

div(style: ("background: red;" %><%=), block: %(), erb: %(), display:: %()) { %(">)
 }

Expected output:

div(style: %(#{"background: red;"}#{"display: block"}))
@marcoroth
Copy link
Owner Author

marcoroth commented Feb 6, 2023

The Deface parser is currently not correctly transforming this provided input:

require "deface"

html = %(<div style="<%= "background: red;" %> <%= "display: block;" %>"></div>)

Deface::Parser.erb_markup!(html)

html
# => "<div  data-erb-style=\"&lt;%= &quot;background: red;&quot; %&gt; &lt;%= \"display: block;\" </erb>\"></div>"

The second set of quotes within an HTML attribute doesn't get escaped.

marcoroth added a commit that referenced this issue Feb 6, 2023
Resolves #76 and Resolves #77 

Additionally adds failing tests for #85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant