phlexing
phlexing copied to clipboard
More than one ERB string interpolation in HTML attribute
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"}))
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=\"<%= "background: red;" %> <%= \"display: block;\" </erb>\"></div>"
The second set of quotes within an HTML attribute doesn't get escaped.