Skip to content

Provide access to the contents of quoted strings #94

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
nex3 opened this issue Dec 21, 2019 · 3 comments · Fixed by #128
Closed

Provide access to the contents of quoted strings #94

nex3 opened this issue Dec 21, 2019 · 3 comments · Fixed by #128

Comments

@nex3
Copy link
Contributor

nex3 commented Dec 21, 2019

Quoted.value returns the text of the string token as written in the stylesheet. This is useful in some circumstances, but in others the contents of the string is more important. This can be loosely approximated by stripping the string's quotes, but that returns an incorrect result if the string contains any kind of escape code.

Feature Use Case

I'm writing a PostCSS plugin that processes certain custom at-rules that are followed by quoted strings (for example, @foo "bar"). I need to access the values of those strings.

Feature Proposal

I propose a Quoted.contents getter that returns the semantic contents of the string. For example, for the CSS value "\"" it would return the string '"', and for the CSS value "\61"' it would return the string "a"`.

@niksy
Copy link
Contributor

niksy commented Oct 30, 2020

Is this issue still valid? I don’t see any option to access unquoted value.

@shellscape
Copy link
Owner

@niksy happy to review a PR to add this feature. without community contribution it likely won't be reopened.

niksy added a commit to niksy/postcss-values-parser that referenced this issue Nov 3, 2020
@niksy
Copy link
Contributor

niksy commented Nov 3, 2020

@shellscape done in #128!

niksy added a commit to niksy/postcss-values-parser that referenced this issue Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants