Skip to content

Commit 534c732

Browse files
committed
Fixed Windows line endings.
1 parent e228212 commit 534c732

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

internal.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ Object.freeze(EMPTYARRAY);
4343

4444
const REG_1 = /[\n\r\t]+/g;
4545
const REG_2 = /\s{2,}/g;
46-
const REG_4 = /(\r)?\n\s{2,}./g;
47-
const REG_5 = />(\r)?\n\s{1,}</g;
46+
const REG_4 = /\n\s{2,}./g;
47+
const REG_5 = />\n\s{1,}</g;
4848
const REG_6 = /[<\w"\u0080-\u07ff\u0400-\u04FF]+\s{2,}[\w\u0080-\u07ff\u0400-\u04FF>]+/;
4949
const REG_7 = /\\/g;
5050
const REG_8 = /'/g;
51-
const REG_9 = />(\r)?\n\s+/g;
52-
const REG_10 = /(\w|\W)(\r)?\n\s+</g;
51+
const REG_9 = />\n\s+/g;
52+
const REG_10 = /(\w|\W)\n\s+</g;
53+
const REG_WIN = /\r/g;
5354
const REG_BLOCK_BEG = /@\{block.*?\}/i;
5455
const REG_BLOCK_END = /@\{end\}/i;
5556
const REG_SKIP_1 = /\('|"/;
@@ -64,7 +65,7 @@ const REG_NOCOMPRESS = /@\{nocompress\s\w+}/gi;
6465
const REG_TAGREMOVE = /[^>](\r)\n\s{1,}$/;
6566
const REG_HELPERS = /helpers\.[a-z0-9A-Z_$]+\(.*?\)+/g;
6667
const REG_SITEMAP = /\s+(sitemap_navigation\(|sitemap\()+/g;
67-
const REG_CSS_1 = /(\r)?\n|\s{2,}/g;
68+
const REG_CSS_1 = /\n|\s{2,}/g;
6869
const REG_CSS_2 = /\s?\{\s{1,}/g;
6970
const REG_CSS_3 = /\s?\}\s{1,}/g;
7071
const REG_CSS_4 = /\s?:\s{1,}/g;
@@ -2826,7 +2827,7 @@ function compressHTML(html, minify, isChunk) {
28262827
if (!html || !minify)
28272828
return html;
28282829

2829-
html = removeComments(html);
2830+
html = removeComments(html.replace(REG_WIN, ''));
28302831

28312832
var tags = ['script', 'textarea', 'pre', 'code'];
28322833
var id = '[' + new Date().getTime() + ']#';

test/test-framework-debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function test_routing(next) {
173173
utils.request(url + 'html-nocompress/', ['get'], function(error, data, code, headers) {
174174
if (error)
175175
throw error;
176-
assert(data.indexOf('<div>\nA\n</div>') !== -1, 'HTML nocompress');
176+
assert(data.indexOf('<div>\nA\n</div>') !== -1 || data.indexOf('<div>\r\nA\r\n</div>') !== -1, 'HTML nocompress');
177177
complete();
178178
});
179179
});

test/test-framework-release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function test_routing(next) {
173173
utils.request(url + 'html-nocompress/', ['get'], function(error, data, code, headers) {
174174
if (error)
175175
throw error;
176-
assert(data.indexOf('<div>\nA\n</div>') !== -1, 'HTML nocompress');
176+
assert(data.indexOf('<div>\nA\n</div>') !== -1 || data.indexOf('<div>\r\nA\r\n</div>') !== -1, 'HTML nocompress');
177177
complete();
178178
});
179179
});

0 commit comments

Comments
 (0)