Closed PhilippMeissner closed 8 years ago
HI Phillip, I'm glad this has been helpful for you.
Thanks for the detailed error report. It's good that you picked this up, as I imagine this must be causing a lot of problems for people, as boolean attributes are quite common. It's also a problem for int attributes such as tabindex.
I've made a quick fix which is to remove any bool or int attributes from the "attribute function whitelist". What this means is that now any int or bool attributes will be converted using the Html.Attribute.attribute function.
Eg: <input readonly>
will be converted to input [ attribute "readonly" "" ] []
. This should successfully compile now, although it's not ideal. I've created another issue to improve things: https://github.com/mbylstra/html-to-elm/issues/16.
This is what your example looks like with the latest version:
div [ class "form-group" ]
[ input [ class "form-control", attribute "data-validation-required-message" "Please enter your name.", id "name", placeholder "Your Name *", attribute "required" "", type' "text" ]
[]
, p [ class "help-block text-danger" ]
[]
]
Hi there,
First of all, thanks for your great work! This tool really saves a lot of time!
I experienced some mismatches when trying to convert attributes like
novalidate
orrequired
. The documentation of theelm-lang/html
-package expects either of these functions to be called with a Bool, but instead the parser delivers an empty String.Here's an example:
becomes
So
required
as an attribute in HTML should be parsed torequired True
instead ofrequired ""
. From my experience the same applies tonovalidate
. Maybe there's other attributes that expect aBool
instead of aString
.Let me know if there's anything else you need :)