Skip to content

Commit

Permalink
Minor additional tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Jun 30, 2018
1 parent b6b8472 commit bdb9837
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions js/lib/beautify-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,8 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
}

// only need to search for custom delimiter for the first few characters
if (!matched && comment.length < 10) {
if (!matched) {
matched = comment.length > 10;
if (comment.indexOf('<![if') === 0) { //peek for <![if conditional comment
delimiter = '<![endif]>';
matched = true;
Expand Down Expand Up @@ -1041,8 +1042,8 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
}
multi_parser.print_token(token.text);
if (multi_parser.indent_content) {
if ((multi_parser.indent_body_inner_html || !token.text.match(/<body(?:.*)>/)) &&
(multi_parser.indent_head_inner_html || !token.text.match(/<head(?:.*)>/))) {
if ((multi_parser.indent_body_inner_html || token.tag_name !== 'body') &&
(multi_parser.indent_head_inner_html || token.tag_name !== 'head')) {

multi_parser.indent();
}
Expand Down
7 changes: 4 additions & 3 deletions js/src/html/beautifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
}

// only need to search for custom delimiter for the first few characters
if (!matched && comment.length < 10) {
if (!matched) {
matched = comment.length > 10;
if (comment.indexOf('<![if') === 0) { //peek for <![if conditional comment
delimiter = '<![endif]>';
matched = true;
Expand Down Expand Up @@ -892,8 +893,8 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
}
multi_parser.print_token(token.text);
if (multi_parser.indent_content) {
if ((multi_parser.indent_body_inner_html || !token.text.match(/<body(?:.*)>/)) &&
(multi_parser.indent_head_inner_html || !token.text.match(/<head(?:.*)>/))) {
if ((multi_parser.indent_body_inner_html || token.tag_name !== 'body') &&
(multi_parser.indent_head_inner_html || token.tag_name !== 'head')) {

multi_parser.indent();
}
Expand Down

0 comments on commit bdb9837

Please sign in to comment.