From 84e7cd56633a3c209bb2da1a57fbb6a19753ef55 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 21 Jan 2016 16:38:26 -0800 Subject: [PATCH] Handle xml declaration Closes #683 --- js/lib/beautify-html.js | 2 +- js/test/generated/beautify-html-tests.js | 5 +++++ test/data/html/tests.js | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/js/lib/beautify-html.js b/js/lib/beautify-html.js index 52c794f9a..647196200 100644 --- a/js/lib/beautify-html.js +++ b/js/lib/beautify-html.js @@ -157,7 +157,7 @@ this.Utils = { //Uilities made available to the various functions whitespace: "\n\r\t ".split(''), - single_token: 'br,input,link,meta,source,!doctype,basefont,base,area,hr,wbr,param,img,isindex,embed,?php'.split(','), //all the single tags for HTML + single_token: 'br,input,link,meta,source,!doctype,basefont,base,area,hr,wbr,param,img,isindex,embed,?php,?xml'.split(','), //all the single tags for HTML extra_liners: extra_liners, //for tags that need a line of whitespace before them in_array: function(what, arr) { for (var i = 0; i < arr.length; i++) { diff --git a/js/test/generated/beautify-html-tests.js b/js/test/generated/beautify-html-tests.js index a9f86ca2d..a6772e916 100644 --- a/js/test/generated/beautify-html-tests.js +++ b/js/test/generated/beautify-html-tests.js @@ -219,6 +219,7 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be test_fragment('
This is some text
', '
This is some text
'); test_fragment('
This is some text
', '
This is some text
'); test_fragment('', ''); + test_fragment('', '\n'); // Attribute Wrap - (eof = "\n", indent_attr = " ", over80 = "\n") opts.wrap_attributes = 'force'; @@ -226,6 +227,7 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be test_fragment('
This is some text
', '
This is some text
'); test_fragment('
This is some text
', '
This is some text
'); test_fragment('', ''); + test_fragment('', '\n'); // Attribute Wrap - (eof = "\n", indent_attr = " ", over80 = "\n") opts.wrap_attributes = 'force'; @@ -233,6 +235,7 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be test_fragment('
This is some text
', '
This is some text
'); test_fragment('
This is some text
', '
This is some text
'); test_fragment('', ''); + test_fragment('', '\n'); // Attribute Wrap - (eof = " ", indent_attr = "", over80 = "\n") opts.wrap_attributes = 'auto'; @@ -240,6 +243,7 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be test_fragment('
This is some text
'); test_fragment('
This is some text
', '
This is some text
'); test_fragment('', ''); + test_fragment('', '\n'); // Attribute Wrap - (eof = " ", indent_attr = "", over80 = " ") opts.wrap_attributes = 'auto'; @@ -247,6 +251,7 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be test_fragment('
This is some text
'); test_fragment('
This is some text
'); test_fragment('', ''); + test_fragment('', '\n'); diff --git a/test/data/html/tests.js b/test/data/html/tests.js index d22cbfb70..d72951205 100644 --- a/test/data/html/tests.js +++ b/test/data/html/tests.js @@ -314,6 +314,11 @@ exports.test_data = { fragment: true, input: '', output: '' + }, + { + fragment: true, + input: '', + output: '\n' } ] }, {