-
Notifications
You must be signed in to change notification settings - Fork 467
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
Improve url parsing (allow line-feeds) #1196
Conversation
@@ -434,6 +434,9 @@ namespace Sass { | |||
alternatives < | |||
alnum, | |||
exactly <'/'>, | |||
exactly <'\\'>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a sequence?
sequence< exactly <'\\'>, alternatives< exactly <'\r'>, exactly <'\n'> > >
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really want to be that strict? Seems to work fine and not sure how ruby sass really does it ... this way it also accepts certain escape sequences (which I guess is correct). Feel free to create a more specific spec test ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is stands I believe this would allow cases Ruby Sass does not, and that aren't in the CSS Spec (which is bad)
@import url("foo\
bar");
@import url("foo
bar");
@import url(foo
bar);
//Errors with Ruby Sass
@import url(foo\
bar);
Ruby Sass
@import url("foobar");
@import url("foo\a bar");
@import url(foo bar);
With this patch
@import url("foobar");
@import url("foo\abar");
@import url(foo
bar);
@import url(foobar);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it looks like Ruby Sass treats the new line in the quoted string as a space delimited list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see you're point!
7e07749
to
95fc4f8
Compare
@@ -21,7 +21,7 @@ namespace Sass { | |||
string comment_to_string(const string& text); | |||
string normalize_wspace(const string& str); | |||
|
|||
string quote(const string&, char q = 0); | |||
string quote(const string&, char q = 0, bool flag = false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does flag
mean? Is there a better name that will describe what this is for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't yet come around to look more into it. But it's the reason why I added WIP again. Again I don't really know if we need to move the code part that uses this flag to another function. Will have another look after work 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok cool. I'm just catching up trying to prepare for a new node-sass release.
Update the specs sass/sass-spec#374 |
95fc4f8
to
258e8b7
Compare
I renamed the flag to |
Are just handling If the |
I noticed another thing @import url("foo
bar"); Produces a deprecation warning in Ruby Sass
But not Libsass @import url("foo\a bar"); Libsass does however produce the deprecation warning if there is more content after the @import url("foo
bar");
// foo |
Given this new information it would seem I was incorrect in thinking Ruby turned multi-line strings into lists. It appears to native support multi-line strings but normalises the newline to a space in the output phase. |
258e8b7
to
9b8545b
Compare
Improve url parsing (allow line-feeds)
🎉 |
Fixes #1096