Skip to content

Commit

Permalink
util: Adds CRLF awareness to quote().
Browse files Browse the repository at this point in the history
Input:

```scss
@import url("a
b");
```

Output on Windows:

```css
"@import url(\"a\r\a b\")";
```

Output on Unix (alinged with Ruby Sass, hence the expected output):

```css
"@import url(\"a\a b\")";
```

See: sass#1096 (comment)
for details.
  • Loading branch information
am11 committed Dec 30, 2015
1 parent 24e15fe commit 27ef312
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ namespace Sass {

int cp = utf8::next(it, end);

// in case of \r, check if the next in sequence
// is \n and then advance the iterator.
if (cp == '\r' && it < end && utf8::peek_next(it, end) == '\n') {
cp = utf8::next(it, end);
}

if (cp == '\n') {
quoted.push_back('\\');
quoted.push_back('a');
Expand Down

0 comments on commit 27ef312

Please # to comment.