Skip to content

Commit

Permalink
Normalize decimals in IE keyword args
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyfer committed Nov 19, 2014
1 parent dfdeac6 commit e1d9263
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ namespace Sass {
lex< exactly<'='> >();
*kwd_arg << new (ctx.mem) String_Constant(path, source_position, lexed);
if (lex< variable >()) *kwd_arg << new (ctx.mem) Variable(path, source_position, Util::normalize_underscores(lexed));
else if (lex< number >()) *kwd_arg << new (ctx.mem) Textual(path, source_position, Textual::NUMBER, Util::normalize_decimals(lexed));
else {
lex< alternatives< identifier_schema, identifier, number, hex > >();
*kwd_arg << new (ctx.mem) String_Constant(path, source_position, lexed);
Expand Down
7 changes: 7 additions & 0 deletions util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ namespace Sass {
return normalized;
}

string normalize_decimals(const string& str) {
string prefix = "0";
string normalized = str;

return normalized[0] == '.' ? normalized.insert(0, prefix) : normalized;
}

bool isPrintable(Ruleset* r) {
if (r == NULL) {
return false;
Expand Down
1 change: 1 addition & 0 deletions util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Sass {
namespace Util {

std::string normalize_underscores(const std::string& str);
std::string normalize_decimals(const std::string& str);

bool containsAnyPrintableStatements(Block* b);

Expand Down

0 comments on commit e1d9263

Please sign in to comment.