Commit 6030f08c by Aaron Leung

Expanded-style output is looking good.

parent e476b60c
......@@ -68,13 +68,15 @@ namespace Sass {
}
}
void Node::emit_expanded_css(stringstream& buf, string prefix) {
void Node::emit_expanded_css(stringstream& buf, const string& prefix) {
switch (type) {
case value:
case selector:
if (!prefix.empty()) buf << " ";
buf << string(token);
break;
case comment:
if (!prefix.empty()) buf << " ";
buf << string(token) << endl;
break;
case property:
......@@ -99,9 +101,10 @@ namespace Sass {
opt_children[i].emit_expanded_css(buf, prefix);
break;
case ruleset:
buf << prefix << " ";
buf << prefix;
children[0].emit_expanded_css(buf, prefix);
children[1].emit_expanded_css(buf, prefix + string(children[0].token));
string newprefix(prefix.empty() ? prefix : prefix + " ");
children[1].emit_expanded_css(buf, newprefix + string(children[0].token));
break;
}
}
......
......@@ -33,6 +33,6 @@ namespace Sass {
void push_child(const Node& node);
void push_opt_child(const Node& node);
void dump(unsigned int depth = 0);
void emit_expanded_css(std::stringstream& buf, string prefix);
void emit_expanded_css(std::stringstream& buf, const string& prefix);
};
}
\ No newline at end of file
/* top level comment -- should preserved */
div {
/* a comment that should be preserved */
/* another comment that should be preserved */
color: red;
background: blue;
span {
......@@ -8,8 +9,13 @@ div {
text-decoration: none;
color: green;
}
/* second comment that should be preserved */
/* yet another comment that should be preserved */
display: inline-block;
}
p {
padding: 10px 8%;
}
margin: 10px 5px;
}
/* last comment, top level again --
compare the indentation! */
\ No newline at end of file
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