Compiler fails to un-escape parser options #63

joepie91 opened this Issue Apr 15, 2016 · 6 comments


None yet

3 participants


While trying to specify Babel options to Riot without using a .babelrc (I'll be opening a separate ticket about this), I discovered that you can specify options on a <script> tag, to have the options in question passed along to the parser. This doesn't seem to be documented, but it also doesn't work - for example, the following Jade-generated code:

<script options="{&quot;presets&quot;: [&quot;es2015-riot&quot;]}">

... will result in the following error:

Error: ./development/components/app.tag
Module build failed: SyntaxError: Unexpected token &
    at Object.parse (native)

... failing here due to not un-escaping the &quot;s in the attribute value (which is unsurprising, given that it uses regular expressions to parse it out, rather than a real HTML parser). This should probably be fixed :)


Why do you set the options using the &quot; instead of the regular quotes?

joepie91 commented Apr 15, 2016 edited

That's how you're supposed to escape quotes in HTML attributes, per spec, and should thus be supported by anything that attempts to parse HTML attributes. The &quot; escaping in this case is generated by Jade.


ok I got it, but this seems to me more a jade issue pugjs/pug#198


It's not. It's valid (X)HTML, according to spec, and thus Riot should either support it, or use a standard HTML parser that already supports this.


I will release a patch asap, it seems to me quite easy to fix


Thanks :)

@GianlucaGuarini GianlucaGuarini added a commit that referenced this issue Apr 16, 2016
@GianlucaGuarini GianlucaGuarini closes #63 80d8570
@aMarCruz aMarCruz closed this Apr 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment