diff --git a/to_string.cpp b/to_string.cpp index 361c47facc..b29c4b9470 100644 --- a/to_string.cpp +++ b/to_string.cpp @@ -31,4 +31,26 @@ namespace Sass { inline string To_String::operator()(Null* n) { return ""; } + + inline string To_String::operator()(List* list) + { + string str = ""; + string sep(list->separator() == List::SPACE ? " " : ","); + if (list->empty()) return str; + bool items_output = false; + + for (size_t i = 0, L = list->size(); i < L; ++i) { + Expression* list_item = (*list)[i]; + if (list_item->is_invisible()) { + continue; + } + if (items_output) str += sep; + if (items_output && sep != " ") str += " "; + if (list_item->concrete_type() == Expression::LIST) str += "("; + str += list_item->perform(this); + if (list_item->concrete_type() == Expression::LIST) str += ")"; + items_output = true; + } + return str; + } } diff --git a/to_string.hpp b/to_string.hpp index 38c2a118f2..ba022781a7 100644 --- a/to_string.hpp +++ b/to_string.hpp @@ -26,6 +26,7 @@ namespace Sass { string operator()(Null* n); string operator()(String_Constant*); + string operator()(List*); template string fallback(U n) { return fallback_impl(n); }