Commit 34b40abc by Aaron Leung

Emitting block directives correctly (semantic-wise, anyway). Output of closing braces is a bit off.

parent 89942b12
...@@ -367,9 +367,8 @@ namespace Sass { ...@@ -367,9 +367,8 @@ namespace Sass {
} }
} break; } break;
case ruleset: case ruleset: {
case block_directive: { Node sel_group(at(2));
Node sel_group(at(type() == ruleset ? 2 : 0));
Node block(at(1)); Node block(at(1));
if (block.has_expansions()) block.flatten(); if (block.has_expansions()) block.flatten();
...@@ -379,6 +378,7 @@ namespace Sass { ...@@ -379,6 +378,7 @@ namespace Sass {
buf << " {"; buf << " {";
for (size_t i = 0, S = block.size(); i < S; ++i) { for (size_t i = 0, S = block.size(); i < S; ++i) {
Type stm_type = block[i].type(); Type stm_type = block[i].type();
if (stm_type == block_directive) buf << endl;
switch (stm_type) switch (stm_type)
{ {
case comment: case comment:
...@@ -421,12 +421,29 @@ namespace Sass { ...@@ -421,12 +421,29 @@ namespace Sass {
buf << ";"; buf << ";";
} break; } break;
// case block_directive: { case block_directive: {
// buf << string(2*depth, ' '); Node header(at(0));
// buf << at(0).to_string() << " {" << endl; Node block(at(1));
// at(1).emit_nested_css(buf, depth+1, false, false); if (block.has_expansions()) block.flatten();
// buf << " }" << endl << endl; buf << string(2*depth, ' ');
// } break; buf << header.to_string();
buf << " {";
for (size_t i = 0, S = block.size(); i < S; ++i) {
switch (block[i].type())
{
case ruleset:
case media_query:
case block_directive:
buf << endl;
break;
default:
break;
}
block[i].emit_nested_css(buf, depth+1, false, in_media_query);
}
buf << " }" << endl;
if ((depth == 0) && at_toplevel && !in_media_query) buf << endl;
} break;
case propset: { case propset: {
emit_propset(buf, depth, ""); emit_propset(buf, depth, "");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment