Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler fails to un-escape parser options #63

Closed
joepie91 opened this issue Apr 15, 2016 · 6 comments
Closed

Compiler fails to un-escape parser options #63

joepie91 opened this issue Apr 15, 2016 · 6 comments
Labels

Comments

@joepie91
Copy link

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 :)

@GianlucaGuarini
Copy link
Member

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

@joepie91
Copy link
Author

joepie91 commented Apr 15, 2016

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.

@GianlucaGuarini
Copy link
Member

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

@joepie91
Copy link
Author

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.

@GianlucaGuarini
Copy link
Member

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

@joepie91
Copy link
Author

Thanks :)

GianlucaGuarini added a commit that referenced this issue Apr 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants