Skip to content

Create quoted strings coming via API #1289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2015
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,11 @@ namespace Sass {
e = new (ctx.mem) Color(pstate, sass_color_get_r(v), sass_color_get_g(v), sass_color_get_b(v), sass_color_get_a(v));
} break;
case SASS_STRING: {
e = new (ctx.mem) String_Constant(pstate, sass_string_get_value(v));
if (sass_string_is_quoted(v))
e = new (ctx.mem) String_Quoted(pstate, sass_string_get_value(v));
else {
e = new (ctx.mem) String_Constant(pstate, sass_string_get_value(v));
}
} break;
case SASS_LIST: {
List* l = new (ctx.mem) List(pstate, sass_list_get_length(v), sass_list_get_separator(v) == SASS_COMMA ? List::COMMA : List::SPACE);
Expand Down
2 changes: 1 addition & 1 deletion sass_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ extern "C" {
return sass_make_color(val->color.r, val->color.g, val->color.b, val->color.a);
} break;
case SASS_STRING: {
return sass_make_string(val->string.value);
return sass_string_is_quoted(val) ? sass_make_qstring(val->string.value) : sass_make_string(val->string.value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if/else would be more consitent IMHO

} break;
case SASS_LIST: {
union Sass_Value* list = sass_make_list(val->list.length, val->list.separator);
Expand Down
11 changes: 10 additions & 1 deletion to_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ namespace Sass {
{ return sass_make_color(c->r(), c->g(), c->b(), c->a()); }

Sass_Value* To_C::operator()(String_Constant* s)
{ return sass_make_string(s->value().c_str()); }
{
if (s->quote_mark()) {
return sass_make_qstring(s->value().c_str());
} else {
return sass_make_string(s->value().c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor indentation / white-space mismatch

}
}

Sass_Value* To_C::operator()(String_Quoted* s)
{ return sass_make_qstring(s->value().c_str()); }

Sass_Value* To_C::operator()(List* l)
{
Expand Down
3 changes: 2 additions & 1 deletion to_c.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace Sass {
Sass_Value* operator()(Number*);
Sass_Value* operator()(Color*);
Sass_Value* operator()(String_Constant*);
Sass_Value* operator()(String_Quoted*);
Sass_Value* operator()(List*);
Sass_Value* operator()(Map*);
Sass_Value* operator()(Null*);
Expand All @@ -41,4 +42,4 @@ namespace Sass {

}

#endif
#endif