8000 Unquoted text on stable · Issue #5 · rs-tml/rstml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Unquoted text on stable #5

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

Closed
vldm opened this issue May 14, 2023 · 1 comment · Fixed by #44
Closed

Unquoted text on stable #5

vldm opened th 8000 is issue May 14, 2023 · 1 comment · Fixed by #44

Comments

@vldm
Copy link
Collaborator
vldm commented May 14, 2023

Currently RawText uses unstable Span::join https://github.com/rs-tml/rstml/blob/v0.10.1/src/node/raw_text.rs#L52
to provide source text with spaces. Because of its unstability it is not availabe on stable rust.
I found that in test https://github.com/rs-tml/rstml/blob/v0.10.1/tests/test.rs#L110 unquoted text is working even on stable, because fallback implementation of proc_macro2::TokenStream can handle Span::join.

Because Unquoted text is important feature in HTML/XML context, we can try to reuse proc_macro2::Span::join.

Proposal:
Implement temporary workaround that will use proc_macro2 fallback implementation directly.

Parse two times:
One with regular TokenStream, and with correct unjoined Span.
And second time with fallback::TokenStream created from Span::call_site().source_text().

Both parse phases should return same Node tree, but with different Spans.
Use second Node tree to recover source_text of RawText.

Cons:

  • Parse two time
@vidhanio
Copy link

for the cons, maybe there could be a feature flag you could add to enable re-parsing? this would be useful for people who don't care about having <style>/<script> support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0