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

Properly handle escaped tabs #95

Merged
merged 3 commits into from Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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