Merge branch 'master' into whitespace-important

This commit is contained in:
Liam Newman 2017-11-08 21:05:11 -05:00 committed by GitHub
commit f6ffd38cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 3 deletions

View File

@ -335,7 +335,7 @@ function Beautifier(source_text, options) {
preindent_index += 1;
}
baseIndentString = source_text.substring(0, preindent_index);
js_source_text = source_text.substring(preindent_index);
source_text = source_text.substring(preindent_index);
}

View File

@ -238,7 +238,16 @@ function set_file_editorconfig_opts(file, config) {
// var cli = require('js-beautify/cli'); cli.interpret();
var interpret = exports.interpret = function(argv, slice) {
var parsed = nopt(knownOpts, shortHands, argv, slice);
var parsed;
try {
parsed = nopt(knownOpts, shortHands, argv, slice);
} catch (ex) {
usage(ex);
// console.error(ex);
// console.error('Run `' + getScriptName() + ' -h` for help.');
process.exit(1);
}
if (parsed.version) {
console.log(require('../../package.json').version);

View File

@ -196,7 +196,7 @@ function Beautifier(source_text, options) {
preindent_index += 1;
}
baseIndentString = source_text.substring(0, preindent_index);
js_source_text = source_text.substring(preindent_index);
source_text = source_text.substring(preindent_index);
}

View File

@ -569,6 +569,10 @@ function run_css_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_bea
'.div {}\n' +
'\n' +
'.span {}');
t(
'html {}\n' +
'\n' +
'/*this is a comment*/');
t(
'.div {\n' +
'\ta: 1;\n' +

View File

@ -527,6 +527,10 @@ class CSSBeautifierTest(unittest.TestCase):
'.div {}\n' +
'\n' +
'.span {}')
t(
'html {}\n' +
'\n' +
'/*this is a comment*/')
t(
'.div {\n' +
'\ta: 1;\n' +

View File

@ -244,6 +244,7 @@ exports.test_data = {
{ unchanged: '#bla,\n\n#foo {\n\tcolor: black;\n\tfont-size: 12px;\n}' },
{ unchanged: 'a {\n\tb: c;\n\n\n\td: {\n\t\te: f;\n\t}\n}' },
{ unchanged: '.div {}\n\n.span {}' },
{ unchanged: 'html {}\n\n/*this is a comment*/' },
{ unchanged: '.div {\n\ta: 1;\n\n\n\tb: 2;\n}\n\n\n\n.span {\n\ta: 1;\n}' },
{ unchanged: '.div {\n\n\n\ta: 1;\n\n\n\tb: 2;\n}\n\n\n\n.span {\n\ta: 1;\n}' },
{ unchanged: '@media screen {\n\t.div {\n\t\ta: 1;\n\n\n\t\tb: 2;\n\t}\n\n\n\n\t.span {\n\t\ta: 1;\n\t}\n}\n\n.div {}\n\n.span {}' },