Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Commit

Permalink
Properly handle escaped tabs (#95)
Browse files Browse the repository at this point in the history
Closes #94
  • Loading branch information
nex3 committed Nov 7, 2018
1 parent 6f35128 commit b2b80e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc-src/SASS_CHANGELOG.md
Expand Up @@ -3,6 +3,10 @@
* Table of contents
{:toc}

## 3.7.1 (Unreleased)

* Properly handle escaped whitespace and other unusual characters.

## 3.7.0 (6 November 2018)

* Add support for CSS's `min()` and `max()` [math functions][]. A `min()` and
Expand Down
2 changes: 2 additions & 0 deletions lib/sass/scss/parser.rb
Expand Up @@ -991,6 +991,8 @@ def value!
# containing the value.
# This results in a dramatic speed increase.
if (val = tok(STATIC_VALUE))
# If val ends with escaped whitespace, leave it be.
val = val.lstrip.sub(/(?<!\\)\s*$/, '\1')
str = Sass::Script::Tree::Literal.new(Sass::Script::Value::String.new(val.strip))
str.line = start_pos.line
str.source_range = range(start_pos)
Expand Down
2 changes: 1 addition & 1 deletion lib/sass/scss/rx.rb
Expand Up @@ -52,7 +52,7 @@ def self.quote(str, flags = 0)
UNICODE = /\\#{H}{1,6}[ \t\r\n\f]?/
s = '\u{80}-\u{D7FF}\u{E000}-\u{FFFD}\u{10000}-\u{10FFFF}'
NONASCII = /[#{s}]/
ESCAPE = /#{UNICODE}|\\[ -~#{s}]/
ESCAPE = /#{UNICODE}|\\[^0-9a-fA-F\r\n\f]/
NMSTART = /[_a-zA-Z]|#{NONASCII}|#{ESCAPE}/
NMCHAR = /[a-zA-Z0-9_-]|#{NONASCII}|#{ESCAPE}/
STRING1 = /\"((?:[^\n\r\f\\"]|\\#{NL}|#{ESCAPE})*)\"/
Expand Down

0 comments on commit b2b80e0

Please sign in to comment.