mirror of
https://github.com/beautifier/js-beautify.git
synced 2024-11-27 14:40:23 +00:00
Fix multiline tags with line break before whitespace
This commit is contained in:
parent
8c4f07a64d
commit
fcb6085fdc
@ -649,6 +649,9 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
|
||||
// then not un-indent correctly
|
||||
if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
|
||||
tag_index = tag_complete.indexOf(' ');
|
||||
if (tag_complete.substring(0, tag_index).indexOf('\n') !== -1) { // if there's a line break before the space, thats where the tag name ends
|
||||
tag_index = tag_complete.indexOf('\n');
|
||||
}
|
||||
} else if (tag_complete.indexOf('\n') !== -1) { //if there's a line break, thats where the tag name ends
|
||||
tag_index = tag_complete.indexOf('\n');
|
||||
} else if (tag_complete.charAt(0) === '{') {
|
||||
|
@ -501,6 +501,9 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
|
||||
// then not un-indent correctly
|
||||
if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
|
||||
tag_index = tag_complete.indexOf(' ');
|
||||
if (tag_complete.substring(0, tag_index).indexOf('\n') !== -1) { // if there's a line break before the space, thats where the tag name ends
|
||||
tag_index = tag_complete.indexOf('\n');
|
||||
}
|
||||
} else if (tag_complete.indexOf('\n') !== -1) { //if there's a line break, thats where the tag name ends
|
||||
tag_index = tag_complete.indexOf('\n');
|
||||
} else if (tag_complete.charAt(0) === '{') {
|
||||
|
@ -2688,6 +2688,11 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be
|
||||
'<?= "A" ?>\n' +
|
||||
'<?= "B" ?>\n' +
|
||||
'<?= "C" ?>');
|
||||
test_fragment(
|
||||
'<?php\n' +
|
||||
'echo "A";\n' +
|
||||
'?>\n' +
|
||||
'<span>Test</span>');
|
||||
|
||||
|
||||
//============================================================
|
||||
|
@ -845,6 +845,14 @@ exports.test_data = {
|
||||
'<?= "B" ?>',
|
||||
'<?= "C" ?>'
|
||||
]
|
||||
}, {
|
||||
fragment: true,
|
||||
unchanged: [
|
||||
'<?php',
|
||||
'echo "A";',
|
||||
'?>',
|
||||
'<span>Test</span>'
|
||||
]
|
||||
}]
|
||||
}, {
|
||||
name: "Support simple language specific option inheritance/overriding",
|
||||
|
Loading…
Reference in New Issue
Block a user