mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] [sass-convert] Properly convert escaped backslashes in SassScript strings as well.
This commit is contained in:
parent
d9e42478ff
commit
731891b5c3
2 changed files with 6 additions and 0 deletions
|
@ -11,6 +11,8 @@ module Sass::Script
|
|||
|
||||
# @see Node#to_sass
|
||||
def to_sass
|
||||
# Replace single backslashes with double. Really.
|
||||
value = self.value.gsub("\\", "\\\\\\\\")
|
||||
return "\"#{value}\"" unless value.include?('"')
|
||||
return "'#{value}'" unless value.include?("'")
|
||||
"\"#{value.gsub('"', "\\\"")}\"" #'
|
||||
|
|
|
@ -39,6 +39,10 @@ class SassScriptConversionTest < Test::Unit::TestCase
|
|||
assert_equal '"quote\'quote\\"quote"', render("'quote\\'quote\"quote'")
|
||||
end
|
||||
|
||||
def test_string_escapes
|
||||
assert_renders '"foo\\\\bar"'
|
||||
end
|
||||
|
||||
def test_funcall
|
||||
assert_renders "foo(true, blue)"
|
||||
assert_renders "hsla(20deg, 30%, 50%, 0.3)"
|
||||
|
|
Loading…
Add table
Reference in a new issue