From bf9a87dc0ebf79a8ac1e179f7648e38f324cf3dd Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sun, 3 Aug 2014 09:43:20 +0100 Subject: [PATCH] Fix CR handling by HTML parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @pmario and @welford - I’m not presenting this as a fix for #717 because I’m still not in a position to reproduce it. However, I found this during a review of newline handling code, and would be interested if it is implicated in the problems you are reporting. --- core/modules/parsers/wikiparser/rules/html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/parsers/wikiparser/rules/html.js b/core/modules/parsers/wikiparser/rules/html.js index 0062d5988..71cdfd5dc 100644 --- a/core/modules/parsers/wikiparser/rules/html.js +++ b/core/modules/parsers/wikiparser/rules/html.js @@ -48,7 +48,7 @@ exports.parse = function() { // Advance the parser position to past the tag this.parser.pos = tag.end; // Check for an immediately following double linebreak - var hasLineBreak = !tag.isSelfClosing && !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n]*\r?\n(?:[^\S\n]*\r?\n|$))/g); + var hasLineBreak = !tag.isSelfClosing && !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g); // Set whether we're in block mode tag.isBlock = this.is.block || hasLineBreak; // Parse the body if we need to @@ -125,7 +125,7 @@ exports.parseTag = function(source,pos,options) { pos = token.end; // Check for a required line break if(options.requireLineBreak) { - token = $tw.utils.parseTokenRegExp(source,pos,/([^\S\n]*\r?\n(?:[^\S\n]*\r?\n|$))/g); + token = $tw.utils.parseTokenRegExp(source,pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g); if(!token) { return null; }