Commit 85e627df by Aaron Leung

More robustly trimming trailing whitespace off of the output.

parent 3353ac2c
......@@ -133,7 +133,21 @@ namespace Sass {
break;
}
string retval(output.str());
if (!retval.empty()) retval.resize(retval.size()-1);
// trim trailing whitespace
if (!retval.empty()) {
size_t newlines = 0;
for (size_t i = retval.length() - 1; i >= 0; --i) {
if (retval[i] == '\n') {
++newlines;
continue;
}
else {
break;
}
}
retval.resize(retval.length() - newlines);
retval += "\n";
}
return retval;
}
}
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