Closed bbugh closed 8 years ago
Hey @bbugh thanks for tracking this bug!
I fixed it temporarily for myself by simply replacing <| with :star: before the tokenization, and then swapping them back after the generation.
I've just pushed a fix which is basically what you suggested.
I'm sure there's a better way, though.
The htmlparser2
docs are sparse at best and I couldn't find anything that would work in this scenario. In any case, I like the hack-and-slash solution of the find and replace, not the most elegant one, but definitely the most cost-effective.
I also updated the Atom plugin.
Cheers!
The
<|
operator is being seen as an open tag by htmlparser2.Here's a contrived example:
results in this code:
Which is definitely not valid Elm. 😄
I checked into the elmx parser, and as expected, the htmlparser2 is seeing the pipe symbol as a tag.
I tried various things to skip operation if the name was a pipe but everything I tried resulted in an error:
It looks like since htmlparser2 reports an open tag, it never properly reports a closed tag, so everything comes through as text mode. I'm not familiar with that library and other than specifying a custom tokenizer, I didn't see any way to tell it to skip certain tags.
I fixed it temporarily for myself by simply replacing
<|
with ⭐️ before the tokenization, and then swapping them back after the generation. I'm sure there's a better way, though. 😆