Permalink
Browse files

v2.3.0 - Update js-beautify to 1.6.4

  • Loading branch information...
1 parent 4116b9c commit cf573d69028fe8f47feaaad131797a246c45103c @Hirse Hirse committed Sep 4, 2016
Showing with 267 additions and 179 deletions.
  1. +9 −0 CHANGELOG.md
  2. +2 −2 README.md
  3. +1 −1 nls/strings.js
  4. +5 −5 package.json
  5. +18 −5 thirdparty/beautify-css.js
  6. +14 −4 thirdparty/beautify-html.js
  7. +218 −162 thirdparty/beautify.js
View
@@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file.
This project tries to adhere to [Semantic Versioning](http://semver.org/).
+## 2.3.0 - 2016-09-04
+### Added
+- Farsi (Persian) Translation
+
+### Changed
+- Updated Italian Translation
+- Updated js-beautify to version 1.6.4
+
+
## 2.2.0 - 2016-06-12
### Added
- Configure any program to beautify a language
View
@@ -1,5 +1,5 @@
# Brackets Beautify 2.x
-[Brackets][Brackets] Extension that formats open HTML, CSS, and JavaScript files using [js-beautify][js-beautify] version [1.6.3][js-beautify version].
+[Brackets][Brackets] Extension that formats open HTML, CSS, and JavaScript files using [js-beautify][js-beautify] version [1.6.4][js-beautify version].
## Version Information
We are currently having [trouble](https://github.com/adobe/brackets/issues/12464) uploading the latest version to the Brackets Extension Registry.
@@ -161,7 +161,7 @@ Brackets Beautify is licensed under the [MIT license][MIT]. [js-beautify][js-bea
[Beautify Beautify on Save]: https://github.com/brackets-beautify/brackets-beautify#file-options-for-beautify-on-save
[Beautify latest release]: https://github.com/brackets-beautify/brackets-beautify/releases/latest
[js-beautify]: https://github.com/beautify-web/js-beautify
-[js-beautify version]: https://github.com/beautify-web/js-beautify/blob/master/CHANGELOG.md#v163
+[js-beautify version]: https://github.com/beautify-web/js-beautify/blob/master/CHANGELOG.md#v164
[js-beautify issues]: https://github.com/beautify-web/js-beautify/issues
[js-beautify options]: https://github.com/beautify-web/js-beautify#options
[SASS Install]: http://sass-lang.com/install
View
@@ -5,10 +5,10 @@ define(function (require, exports, module) {
root: true,
de: true,
es: true,
+ fa: true,
it: true,
ja: true,
ro: true,
- fa: true,
'zh-cn': true
};
});
View
@@ -1,7 +1,7 @@
{
"name": "brackets-beautify",
"title": "Beautify",
- "version": "2.2.0",
+ "version": "2.3.0",
"description": "Format JavaScript, HTML, and CSS files and related languages.",
"engines": {
"brackets": ">=1.7.0"
@@ -32,25 +32,25 @@
"de",
"en",
"es",
+ "fa",
"it",
"ja",
"ro",
- "fa",
"zh-cn"
],
"package-i18n": {
"de": {
"description": "Formatiere JavaScript, HTML, und CSS Dateien und verwandte Sprachen."
},
+ "fa": {
+ "description": "قالب‌بندی فایل‌های جاوااسکریپت، HTML و CSS و زبان‌های مرتبط."
+ },
"it": {
"description": "Formato JavaScript, HTML e file CSS e linguaggi affini."
},
"ro": {
"description": "Formatează fișiere JavaScript, HTML și CSS și alte limbaje apropiate."
},
- "fa": {
- "description": "قالب‌بندی فایل‌های جاوااسکریپت، HTML و CSS و زبان‌های مرتبط."
- },
"zh-cn": {
"description": "格式化JavaScript, HTML, CSS文件以及相关的语言。"
}
@@ -74,7 +74,8 @@
var selectorSeparatorNewline = (options.selector_separator_newline === undefined) ? true : options.selector_separator_newline;
var end_with_newline = (options.end_with_newline === undefined) ? false : options.end_with_newline;
var newline_between_rules = (options.newline_between_rules === undefined) ? true : options.newline_between_rules;
- var spaceAroundSelectorSeparator = (options.space_around_selector_separator === undefined) ? false : options.space_around_selector_separator;
+ var space_around_combinator = (options.space_around_combinator === undefined) ? false : options.space_around_combinator;
+ space_around_combinator = space_around_combinator || ((options.space_around_selector_separator === undefined) ? false : options.space_around_selector_separator);
var eol = options.eol ? options.eol : '\n';
// compatibility
@@ -372,7 +373,8 @@
} else if (ch === ":") {
eatWhitespace();
if ((insideRule || enteringConditionalGroup) &&
- !(lookBack("&") || foundNestedPseudoClass())) {
+ !(lookBack("&") || foundNestedPseudoClass()) &&
+ !lookBack("(")) {
// 'property: value' delimiter
// which could be in a conditional group query
insidePropertyValue = true;
@@ -381,6 +383,11 @@
} else {
// sass/less parent reference don't use a space
// sass nested pseudo-class don't use a space
+
+ // preserve space before pseudoclasses/pseudoelements, as it means "in any child"
+ if (lookBack(" ") && output[output.length - 1] !== " ") {
+ output.push(" ");
+ }
if (peek() === ":") {
// pseudo-element
next();
@@ -425,14 +432,20 @@
} else {
print.singleSpace();
}
- } else if (ch === '>' || ch === '+' || ch === '~') {
- //handl selector separator spacing
- if (spaceAroundSelectorSeparator && !insidePropertyValue && parenLevel < 1) {
+ } else if ((ch === '>' || ch === '+' || ch === '~') &&
+ !insidePropertyValue && parenLevel < 1) {
+ //handle combinator spacing
+ if (space_around_combinator) {
print.singleSpace();
output.push(ch);
print.singleSpace();
} else {
output.push(ch);
+ eatWhitespace();
+ // squash extra whitespace
+ if (ch && whiteRe.test(ch)) {
+ ch = '';
+ }
}
} else if (ch === ']') {
output.push(ch);
@@ -89,6 +89,8 @@
var multi_parser,
indent_inner_html,
+ indent_body_inner_html,
+ indent_head_inner_html,
indent_size,
indent_character,
wrap_line_length,
@@ -112,6 +114,8 @@
}
indent_inner_html = (options.indent_inner_html === undefined) ? false : options.indent_inner_html;
+ indent_body_inner_html = (options.indent_body_inner_html === undefined) ? true : options.indent_body_inner_html;
+ indent_head_inner_html = (options.indent_head_inner_html === undefined) ? true : options.indent_head_inner_html;
indent_size = (options.indent_size === undefined) ? 4 : parseInt(options.indent_size, 10);
indent_character = (options.indent_char === undefined) ? ' ' : options.indent_char;
brace_style = (options.brace_style === undefined) ? 'collapse' : options.brace_style;
@@ -127,7 +131,6 @@
// prexisting - not sure of full effect of removing, leaving in
'acronym', 'address', 'big', 'dt', 'ins', 'small', 'strike', 'tt',
'pre',
- 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
];
preserve_newlines = (options.preserve_newlines === undefined) ? true : options.preserve_newlines;
max_preserve_newlines = preserve_newlines ?
@@ -163,6 +166,8 @@
this.token_text = this.last_token = this.last_text = this.token_type = '';
this.newlines = 0;
this.indent_content = indent_inner_html;
+ this.indent_body_inner_html = indent_body_inner_html;
+ this.indent_head_inner_html = indent_head_inner_html;
this.Utils = { //Uilities made available to the various functions
whitespace: "\n\r\t ".split(''),
@@ -499,7 +504,7 @@
} else if (tag_check === 'script' &&
(tag_complete.search('type') === -1 ||
(tag_complete.search('type') > -1 &&
- tag_complete.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json)/) > -1))) {
+ tag_complete.search(/\b(text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect)/) > -1))) {
if (!peek) {
this.record_tag(tag_check);
this.tag_type = 'SCRIPT';
@@ -847,7 +852,12 @@
multi_parser.print_newline(false, multi_parser.output);
multi_parser.print_token(multi_parser.token_text);
if (multi_parser.indent_content) {
- multi_parser.indent();
+ if ((multi_parser.indent_body_inner_html || !multi_parser.token_text.match(/<body(?:.*)>/)) &&
+ (multi_parser.indent_head_inner_html || !multi_parser.token_text.match(/<head(?:.*)>/))) {
+
+ multi_parser.indent();
+ }
+
multi_parser.indent_content = false;
}
multi_parser.current_mode = 'CONTENT';
@@ -861,7 +871,7 @@
case 'TK_TAG_END':
//Print new line only if the tag has no content and has child
if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
- var tag_name = multi_parser.token_text.match(/\w+/)[0];
+ var tag_name = (multi_parser.token_text.match(/\w+/) || [])[0];
var tag_extracted_from_last_output = null;
if (multi_parser.output.length) {
tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length - 1].match(/(?:<|{{#)\s*(\w+)/);
Oops, something went wrong.

0 comments on commit cf573d6

Please sign in to comment.