Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed problems with colon character #363

Closed
wants to merge 12 commits into from
19 changes: 17 additions & 2 deletions js/lib/beautify-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,19 @@

function peek() {
return source_text.charAt(pos + 1);
}

function getrow() {
var test1 = source_text.substr(pos, source_text.indexOf(';') + 1);
var test2 = source_text.substr(pos, source_text.indexOf('{') + 1);

if(test1.length > test2.length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please match the style of the file: 4 spaces per tab, space between if keyword and opening paren.

return test2;
} else {
return test1;
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces should be stripped.

function eatString(endChar) {
var start = pos;
while (next()) {
Expand Down Expand Up @@ -233,7 +244,11 @@
insideRule = false;
} else if (ch === ":") {
eatWhitespace();
output.push(ch, " ");
if(getrow().indexOf("{") !== -1){
output.push(ch);
} else {
output.push(ch, " ");
}
insideRule = true;
} else if (ch === '"' || ch === '\'') {
output.push(eatString(ch));
Expand Down