stoically / syn-rsx

syn-powered parser for JSX-like TokenStreams

Home Page:https://crates.io/crates/syn-rsx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unquoted Text

stoically opened this issue · comments

Support for <div>Some Text</div> via proc_macro2's span-locations feature by manually calculating the whitespaces based on Span start and end

Depends on rust-lang/rust#54725

Caveat

  • Whitespaces after text and before newline can't be determined correctly, so text that relies on 100% accurate whitespacing (like in <pre>) will not render correctly

Has anyone tried to fork and build manually with nightly to achieve this?

@Snarik I'm currently working on adding the feature behind a feature flag, so that it can be used with nightly rust already, because I'll probably need span start/end to properly implement #43 as well.

That's amazing news! Anything I can do to help?

Hi, i am interesting if it could help parsing inline style/script?

<style>
    div {
      background-color: red;
      color: white;
    }
</style>
<script>
var x = 12;
console.log(x);
if (x>1) {
  // if so, how it treat comments, and templating.
  // what about templating with embeded html?
  var y = ` <div>#{x}<div>`
  console.log(y);
}
</script>

@vldm please use this instead,
https://github.com/rs-tml/rstml

Edit: My bad. @vldm is the creator of rstml. Nice. Maybe this issue can be closed now.