reflex-jsx icon indicating copy to clipboard operation
reflex-jsx copied to clipboard

On self-closing tags and error messages

Open meditans opened this issue 8 years ago • 1 comments

Hi, when embedding an html file into the jsx quasiquoter, it kept signalling an error I couldn't understand:

/tmp/intero2370oKz.hs:30:15: error:
    • (line 3, column 5):
unexpected "d"
expecting "</"
    • In the quasi-quotation:
        [jsx|
        -- all my code, elided for brevity.
        |]

I eventually, through trial and error, discovered that the error was caused by this line:

<input class="form-control search-field" type="search" name="search" id="search-field">

and the problem was that the quasiquoter seems to be unprepared for non-closing tags: for example, this self-closing version has no problems:

<input class="form-control search-field" type="search" name="search" id="search-field"/>

I understand that lifting the closing restriction for some kind of element could cause a major reworking of the code and probably the loss of some safety, but would it be possible at least to have better diagnostic messages, to understand where the code is failing (note that the line in the error message aren't the actual line of the missing closed tag)?

meditans avatar Oct 31 '16 10:10 meditans

this is a good point. in fact it might be easier to relax the syntax to allow non-closing elements per the HTML spec than make better error messages! either way, I'll take a look into it. thank you for the report!

dackerman avatar Oct 31 '16 15:10 dackerman