Skip to content

Commit 3936d74

Browse files
author
GitHub Action
committed
Release: 1.14.9
1 parent fa7264f commit 3936d74

File tree

8 files changed

+34
-7
lines changed

8 files changed

+34
-7
lines changed

js/lib/beautifier.js

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

js/lib/beautifier.js.map

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

js/lib/beautifier.min.js

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

js/lib/beautifier.min.js.map

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

js/lib/beautify-html.js

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

24052405
parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
24062406
parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
2407-
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_name.includes("-") || parser_token.tag_start_char === '{';
2407+
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 === '{';
24082408

24092409
return parser_token;
24102410
};
@@ -2691,6 +2691,7 @@ function Options(options) {
26912691
// obsolete inline tags
26922692
'acronym', 'big', 'strike', 'tt'
26932693
]);
2694+
this.inline_custom_elements = this._get_boolean('inline_custom_elements', true);
26942695
this.void_elements = this._get_array('void_elements', [
26952696
// HTLM void elements - aka self-closing tags - aka singletons
26962697
// https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements

js/lib/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"],

js/test/generated/beautify-html-tests.js

+23
Original file line numberDiff line numberDiff line change
@@ -9269,6 +9269,29 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be
92699269
'</span>');
92709270

92719271

9272+
//============================================================
9273+
// Disables custom elements inlining with inline_custom_elements=false
9274+
reset_options();
9275+
set_name('Disables custom elements inlining with inline_custom_elements=false');
9276+
opts.inline_custom_elements = false;
9277+
bth(
9278+
'<span>\n' +
9279+
' <span>\n' +
9280+
' <span>The time for this result is 1:02</span\n' +
9281+
' ><time-dot>.</time-dot\n' +
9282+
' ><time-decimals>27</time-decimals>\n' +
9283+
' </span>\n' +
9284+
'</span>',
9285+
// -- output --
9286+
'<span>\n' +
9287+
' <span>\n' +
9288+
' <span>The time for this result is 1:02</span>\n' +
9289+
' <time-dot>.</time-dot>\n' +
9290+
' <time-decimals>27</time-decimals>\n' +
9291+
' </span>\n' +
9292+
'</span>');
9293+
9294+
92729295
//============================================================
92739296
// New Test Suite
92749297
reset_options();

python/jsbeautifier/tests/generated/tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10075,7 +10075,7 @@ def test_beautifier_unconverted(self):
1007510075
test_fragment('foo {', 'foo {')
1007610076
test_fragment('return {', 'return {') # return needs the brace.
1007710077
test_fragment('return /* inline */ {', 'return /* inline */ {')
10078-
test_fragment('return;\n{', 'return; {')
10078+
test_fragment('return;\n{', 'return;\n{')
1007910079
bt("throw {}")
1008010080
bt("throw {\n foo;\n}")
1008110081
bt('var foo = {}')
@@ -10166,7 +10166,7 @@ def test_beautifier_unconverted(self):
1016610166
test_fragment('foo {', 'foo {')
1016710167
test_fragment('return {', 'return {') # return needs the brace.
1016810168
test_fragment('return /* inline */ {', 'return /* inline */ {')
10169-
test_fragment('return;\n{', 'return; {')
10169+
test_fragment('return;\n{', 'return;\n{')
1017010170
bt("throw {}")
1017110171
bt("throw {\n foo;\n}")
1017210172
bt('var foo = {}')

0 commit comments

Comments
 (0)