Skip to content

Commit 22310aa

Browse files
committed
Merge pull request #1979 from mgreter/bugfix/issue_1947
Fix quote function to avoid double quoting existing strings
2 parents 140959c + 970a887 commit 22310aa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/functions.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,16 @@ namespace Sass {
902902
BUILT_IN(sass_quote)
903903
{
904904
AST_Node* arg = env["$string"];
905+
// only set quote mark to true if already a string
906+
if (String_Quoted* qstr = dynamic_cast<String_Quoted*>(arg)) {
907+
qstr->quote_mark('*');
908+
return qstr;
909+
}
910+
// all other nodes must be converted to a string node
905911
std::string str(quote(arg->to_string(ctx.c_options), String_Constant::double_quote()));
906912
String_Quoted* result = SASS_MEMORY_NEW(ctx.mem, String_Quoted, pstate, str);
907913
result->is_delayed(true);
914+
result->quote_mark('*');
908915
return result;
909916
}
910917

0 commit comments

Comments
 (0)