Skip to content

Commit

Permalink
Fix quote function to avoid double quoting existing strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Apr 5, 2016
1 parent 140959c commit 970a887
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,9 +902,16 @@ namespace Sass {
BUILT_IN(sass_quote)
{
AST_Node* arg = env["$string"];
// only set quote mark to true if already a string
if (String_Quoted* qstr = dynamic_cast<String_Quoted*>(arg)) {
qstr->quote_mark('*');
return qstr;
}
// all other nodes must be converted to a string node
std::string str(quote(arg->to_string(ctx.c_options), String_Constant::double_quote()));
String_Quoted* result = SASS_MEMORY_NEW(ctx.mem, String_Quoted, pstate, str);
result->is_delayed(true);
result->quote_mark('*');
return result;
}

Expand Down

0 comments on commit 970a887

Please sign in to comment.