@@ -861,7 +861,7 @@ namespace Sass {
861
861
}
862
862
}
863
863
864
- std::string Eval::interpolation (Expression* s) {
864
+ std::string Eval::interpolation (Expression* s, bool into_quotes ) {
865
865
Env* env = environment ();
866
866
if (String_Quoted* str_quoted = dynamic_cast <String_Quoted*>(s)) {
867
867
if (str_quoted->quote_mark ()) {
@@ -874,6 +874,7 @@ namespace Sass {
874
874
return evacuate_escapes (str_quoted->value ());
875
875
}
876
876
} else if (String_Constant* str_constant = dynamic_cast <String_Constant*>(s)) {
877
+ if (into_quotes && !str_constant->is_interpolant ()) return str_constant->value ();
877
878
return evacuate_escapes (str_constant->value ());
878
879
} else if (dynamic_cast <Parent_Selector*>(s)) {
879
880
To_String to_string (&ctx);
@@ -936,7 +937,17 @@ namespace Sass {
936
937
Expression* Eval::operator ()(String_Schema* s)
937
938
{
938
939
std::string acc;
939
- for (size_t i = 0 , L = s->length (); i < L; ++i) {
940
+ bool into_quotes = false ;
941
+ size_t L = s->length ();
942
+ if (L > 1 ) {
943
+ if (String_Constant* l = dynamic_cast <String_Constant*>((*s)[0 ])) {
944
+ if (String_Constant* r = dynamic_cast <String_Constant*>((*s)[L - 1 ])) {
945
+ if (l->value ()[0 ] == ' "' && r->value ()[r->value ().size () - 1 ] == ' "' ) into_quotes = true ;
946
+ if (l->value ()[0 ] == ' \' ' && r->value ()[r->value ().size () - 1 ] == ' \' ' ) into_quotes = true ;
947
+ }
948
+ }
949
+ }
950
+ for (size_t i = 0 ; i < L; ++i) {
940
951
// really a very special fix, but this is the logic I got from
941
952
// analyzing the ruby sass behavior and it actually seems to work
942
953
// https://github.com/sass/libsass/issues/1333
@@ -946,13 +957,13 @@ namespace Sass {
946
957
if (sq->is_delayed () && ! s->has_interpolants ()) {
947
958
acc += string_escape (quote (sq->value (), sq->quote_mark ()));
948
959
} else {
949
- acc += interpolation ((*s)[i]);
960
+ acc += interpolation ((*s)[i], into_quotes );
950
961
}
951
962
} else if (ex) {
952
- acc += interpolation ((*s)[i]);
963
+ acc += interpolation ((*s)[i], into_quotes );
953
964
}
954
965
} else if ((*s)[i]) {
955
- acc += interpolation ((*s)[i]);
966
+ acc += interpolation ((*s)[i], into_quotes );
956
967
}
957
968
}
958
969
String_Quoted* str = SASS_MEMORY_NEW (ctx.mem , String_Quoted, s->pstate (), acc);
0 commit comments