Skip to content

Commit fa7264f

Browse files
author
GitHub Action
committed
Merge remote-tracking branch 'origin/staging/main' into staging/release
2 parents f2a11a3 + d47e418 commit fa7264f

File tree

13 files changed

+114
-48
lines changed

13 files changed

+114
-48
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v1.14.9
4+
* Bump semver and editorconfig ([#2161](https://github.com/beautify-web/js-beautify/pull/2161))
5+
* Update editorconfig package ([#2160](https://github.com/beautify-web/js-beautify/issues/2160))
6+
* Allow to configure the "custom elements as inline elements" behavior ([#2113](https://github.com/beautify-web/js-beautify/issues/2113))
7+
38
## v1.14.8
49
* Require nodejs v12 or greater ([#2151](https://github.com/beautify-web/js-beautify/pull/2151))
510
* CSS insideNonNestedAtRule generic variable ([#2147](https://github.com/beautify-web/js-beautify/pull/2147))

Diff for: README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ JS Beautifier is hosted on two CDN services: [cdnjs](https://cdnjs.com/libraries
5858

5959
To pull the latest version from one of these services include one set of the script tags below in your document:
6060
```html
61-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify.js"></script>
62-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify-css.js"></script>
63-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify-html.js"></script>
61+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify.js"></script>
62+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify-css.js"></script>
63+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify-html.js"></script>
6464

65-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify.min.js"></script>
66-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify-css.min.js"></script>
67-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify-html.min.js"></script>
65+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify.min.js"></script>
66+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify-css.min.js"></script>
67+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify-html.min.js"></script>
6868
```
6969

7070
Example usage of a JS tag in html:
@@ -76,7 +76,7 @@ Example usage of a JS tag in html:
7676

7777
. . .
7878

79-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify.min.js"></script>
79+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify.min.js"></script>
8080
<script src="script.js"></script>
8181
</body>
8282
</html>
@@ -371,6 +371,7 @@ HTML Beautifier Options:
371371
-M, --wrap-attributes-min-attrs Minimum number of html tag attributes for force wrap attribute options [2]
372372
-i, --wrap-attributes-indent-size Indent wrapped attributes to after N characters [indent-size] (ignored if wrap-attributes is "aligned")
373373
-d, --inline List of tags to be considered inline tags
374+
--inline_custom_elements Inline custom elements [true]
374375
-U, --unformatted List of tags (defaults to inline) that should not be reformatted
375376
-T, --content_unformatted List of tags (defaults to pre) whose content should not be reformatted
376377
-E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline before them.
@@ -433,4 +434,4 @@ Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, D
433434
Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull,
434435
Mathias Bynens, Vittorio Gambaletta and others.
435436
436-
(README.md: [email protected].8)
437+
(README.md: [email protected].9)

Diff for: js/src/cli.js

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ var path = require('path'),
116116
// HTML-only
117117
"max_char": Number, // obsolete since 1.3.5
118118
"inline": [String, Array],
119+
"inline_custom_elements": [Boolean],
119120
"unformatted": [String, Array],
120121
"content_unformatted": [String, Array],
121122
"indent_inner_html": [Boolean],
@@ -168,6 +169,7 @@ var path = require('path'),
168169
"i": ["--wrap_attributes_indent_size"],
169170
"W": ["--max_char"], // obsolete since 1.3.5
170171
"d": ["--inline"],
172+
// no shorthand for "inline_custom_elements"
171173
"U": ["--unformatted"],
172174
"T": ["--content_unformatted"],
173175
"I": ["--indent_inner_html"],

Diff for: js/src/html/beautifier.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ Beautifier.prototype._get_tag_open_token = function(raw_token) { //function to g
656656

657657
parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
658658
parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
659-
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_name.includes("-") || parser_token.tag_start_char === '{';
659+
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || (this._options.inline_custom_elements && parser_token.tag_name.includes("-")) || parser_token.tag_start_char === '{';
660660

661661
return parser_token;
662662
};

Diff for: js/src/html/options.js

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function Options(options) {
6161
// obsolete inline tags
6262
'acronym', 'big', 'strike', 'tt'
6363
]);
64+
this.inline_custom_elements = this._get_boolean('inline_custom_elements', true);
6465
this.void_elements = this._get_array('void_elements', [
6566
// HTLM void elements - aka self-closing tags - aka singletons
6667
// https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements

Diff for: package-lock.json

+62-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-beautify",
3-
"version": "1.14.8",
3+
"version": "1.14.9",
44
"description": "beautifier.io for node",
55
"main": "js/index.js",
66
"bin": {
@@ -50,7 +50,7 @@
5050
"browserslist": "ie 11",
5151
"dependencies": {
5252
"config-chain": "^1.1.13",
53-
"editorconfig": "^0.15.3",
53+
"editorconfig": "^1.0.3",
5454
"glob": "^8.1.0",
5555
"nopt": "^6.0.0"
5656
},

Diff for: python/cssbeautifier/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.14.8"
1+
__version__ = "1.14.9"

Diff for: python/cssbeautifier/tests/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Empty file :)

Diff for: python/jsbeautifier/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.14.8"
1+
__version__ = "1.14.9"

Diff for: python/jsbeautifier/tests/generated/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Empty file :)

Diff for: test/data/html/tests.js

+26
Original file line numberDiff line numberDiff line change
@@ -3813,6 +3813,32 @@ exports.test_data = {
38133813
'</span>'
38143814
]
38153815
}]
3816+
}, {
3817+
name: "Disables custom elements inlining with inline_custom_elements=false",
3818+
description: "https://github.com/beautify-web/js-beautify/issues/2113",
3819+
options: [
3820+
{ name: "inline_custom_elements", value: "false" }
3821+
],
3822+
tests: [{
3823+
input: [
3824+
'<span>',
3825+
' <span>',
3826+
' <span>The time for this result is 1:02</span',
3827+
' ><time-dot>.</time-dot',
3828+
' ><time-decimals>27</time-decimals>',
3829+
' </span>',
3830+
'</span>'
3831+
],
3832+
output: [
3833+
'<span>',
3834+
' <span>',
3835+
' <span>The time for this result is 1:02</span>',
3836+
' <time-dot>.</time-dot>',
3837+
' <time-decimals>27</time-decimals>',
3838+
' </span>',
3839+
'</span>'
3840+
]
3841+
}]
38163842
}, {
38173843
name: "New Test Suite"
38183844
}]

Diff for: test/data/javascript/python.mustache

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class TestJSBeautifier(unittest.TestCase):
367367
test_fragment('foo {', 'foo {')
368368
test_fragment('return {', 'return {') # return needs the brace.
369369
test_fragment('return /* inline */ {', 'return /* inline */ {')
370-
test_fragment('return;\n{', 'return; {')
370+
test_fragment('return;\n{', 'return;\n{')
371371
bt("throw {}")
372372
bt("throw {\n foo;\n}")
373373
bt('var foo = {}')
@@ -458,7 +458,7 @@ class TestJSBeautifier(unittest.TestCase):
458458
test_fragment('foo {', 'foo {')
459459
test_fragment('return {', 'return {') # return needs the brace.
460460
test_fragment('return /* inline */ {', 'return /* inline */ {')
461-
test_fragment('return;\n{', 'return; {')
461+
test_fragment('return;\n{', 'return;\n{')
462462
bt("throw {}")
463463
bt("throw {\n foo;\n}")
464464
bt('var foo = {}')

0 commit comments

Comments
 (0)