html-to-elm
html-to-elm copied to clipboard
Double quotes not escaped for inline style
If you input:
<div style="background-image: url("avatar.jpg");"></div>
The result is:
div [ attribute "style" "background-image: url("avatar.jpg");" ]
[]
Which is not valid elm code. It should escape the double quotes:
div [ attribute "style" "background-image: url(\"avatar.jpg\");" ]
[]
A similar case is this multi-line attribute:
<div data-responsive="[{
"breakpoint": 1200,
"settings": {
"slidesToShow": 5
}
}]">
</div>
which is translated to this invalid Elm code:
div [ attribute "data-responsive" "[{
"breakpoint": 1200,
"settings": {
"slidesToShow": 5
}
}]" ]
[]
Elm says:
Elm strings like "this" cannot contain newlines.
Hint: For strings that CAN contain newlines, say """this""" for Elm’s multi-line
string syntax. It allows unescaped newlines and double quotes.
Detected errors in 1 module.