Skip to content

Commit f3d2ead

Browse files
committed
Don't quote strings that weren't quoted
1 parent 2b4b3bf commit f3d2ead

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

eval.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,11 @@ namespace Sass {
700700
if (auto str = dynamic_cast<String_Quoted*>(value)) {
701701
value = new (ctx.mem) String_Quoted(*str);
702702
} else if (auto str = dynamic_cast<String_Constant*>(value)) {
703-
value = new (ctx.mem) String_Constant(*str);
703+
if (str->quote_mark()) {
704+
value = new (ctx.mem) String_Quoted(str->pstate(), str->perform(&to_string));
705+
} else {
706+
value = new (ctx.mem) String_Constant(str->pstate(), unquote(str->value()));
707+
}
704708
}
705709
}
706710
else if (value->concrete_type() == Expression::LIST) {
@@ -812,12 +816,18 @@ namespace Sass {
812816
string Eval::interpolation(Expression* s) {
813817
if (String_Quoted* str_quoted = dynamic_cast<String_Quoted*>(s)) {
814818
if (str_quoted->quote_mark()) {
815-
return string_escape(str_quoted->value());
819+
if (str_quoted->quote_mark() == '*' || str_quoted->is_delayed()) {
820+
return interpolation(new (ctx.mem) String_Constant(*str_quoted));
821+
} else {
822+
return string_escape(quote(str_quoted->value(), str_quoted->quote_mark()));
823+
}
816824
} else {
817825
return evacuate_escapes(str_quoted->value());
818826
}
819827
} else if (String_Constant* str_constant = dynamic_cast<String_Constant*>(s)) {
820-
return evacuate_escapes(str_constant->value());
828+
string str = str_constant->value();
829+
if (!str_constant->quote_mark()) str = unquote(str);
830+
return evacuate_escapes(str);
821831
} else if (String_Schema* str_schema = dynamic_cast<String_Schema*>(s)) {
822832
string res = "";
823833
for(auto i : str_schema->elements())

parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ namespace Sass {
14991499
(*schema) << new (ctx.mem) Textual(pstate, Textual::HEX, unquote(lexed));
15001500
}
15011501
else if (lex< quoted_string >()) {
1502-
(*schema) << new (ctx.mem) String_Constant(pstate, lexed);
1502+
(*schema) << new (ctx.mem) String_Quoted(pstate, lexed);
15031503
}
15041504
else if (lex< variable >()) {
15051505
(*schema) << new (ctx.mem) Variable(pstate, Util::normalize_underscores(lexed));

0 commit comments

Comments
 (0)