Arlolra has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/381380 )
Change subject: Not sure what this is trying to be ... but it isn't ...................................................................... Not sure what this is trying to be ... but it isn't Change-Id: I4a8544c6de2b4598e4d5be60c8f54d6945db970a --- M lib/html2wt/WikitextSerializer.js M tests/parserTests-blacklist.js 2 files changed, 9 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/80/381380/1 diff --git a/lib/html2wt/WikitextSerializer.js b/lib/html2wt/WikitextSerializer.js index 01d82d5..9245dd5 100644 --- a/lib/html2wt/WikitextSerializer.js +++ b/lib/html2wt/WikitextSerializer.js @@ -814,17 +814,7 @@ newSepMatch = res.match(this.separatorREs.sepSuffixWithNlsRE); res = res.replace(this.separatorREs.sepSuffixWithNlsRE, ''); - var doubleNewlineMatch = res.match(this.separatorREs.doubleNewlineRE_G); - var doubleNewlineCount = doubleNewlineMatch && doubleNewlineMatch.length || 0; - - // Don't strip two newlines for wikitext like this: - // <div>foo - // - // bar</div> - // The PHP parser won't create paragraphs on lines that also contain - // block-level tags. - if (!state.inHTMLPre && (!DU.allChildrenAreText(node.parentNode) || - doubleNewlineCount !== 1)) { + if (!state.inHTMLPre) { // Strip more than one consecutive newline res = res.replace(this.separatorREs.doubleNewlineRE_G, '\n'); } diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js index 583c919..c97ef87 100644 --- a/tests/parserTests-blacklist.js +++ b/tests/parserTests-blacklist.js @@ -290,6 +290,9 @@ add("wt2wt", "T2529: Uncovered bullet leaving empty list, normally removed by tidy", "******* Foo \n{{bullet}}"); add("wt2wt", "HHP2.1: Heuristics for headings in preprocessor parenthetical structures", "<nowiki>{{foo|</nowiki>\n=heading=\n"); add("wt2wt", "HHP2.2: Heuristics for headings in preprocessor parenthetical structures", "<nowiki>{{foo|</nowiki>\n==heading==\n"); +add("wt2wt", "Paragraphs inside divs (no extra line breaks)", "<div>Line one\nLine two</div>"); +add("wt2wt", "T8200: paragraphs inside blockquotes (no extra line breaks)", "<blockquote>Line one\nLine two</blockquote>"); +add("wt2wt", "Paragraphs inside blockquotes/divs (no extra line breaks)", "<blockquote><div>Line one\nLine two</div></blockquote>"); add("wt2wt", "T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links", "[http://www.example.org/ ideograms]\n"); add("wt2wt", "Ignore pipe between table row attributes", "{|\n| quux\n|- id=\"foo\" style=\"color: red\" |\n| bar\n|}"); add("wt2wt", "2. Bad treebuilder fixup of formatting elt is cleaned up", "'''foo'''[[File:Foobar.jpg|thumb|'''caption''']]'''bar'''\n\n<small>[[Image:Foobar.jpg|right|300px]]</small>"); @@ -1739,6 +1742,11 @@ add("selser", "HHP2.2: Heuristics for headings in preprocessor parenthetical structures [0,3,[4]]", "{{foo|\n==fcodkw=="); add("selser", "HHP2.2: Heuristics for headings in preprocessor parenthetical structures [0,0,3]", "{{foo|\n"); add("selser", "HHP2.2: Heuristics for headings in preprocessor parenthetical structures [0,0,[4]]", "{{foo|\n==hxhkvc=="); +add("selser", "Paragraphs inside divs (no extra line breaks) [2]", "1dt72ut<div>Line one\n\nLine two</div>"); +add("selser", "T8200: paragraphs inside blockquotes (no extra line breaks) [2]", "wkz005<blockquote>Line one\n\nLine two</blockquote>"); +add("selser", "Paragraphs inside blockquotes/divs (no extra line breaks) [1]", "<blockquote data-foobar=\"1it61nk\"><div>Line one\n\nLine two</div></blockquote>"); +add("selser", "Paragraphs inside blockquotes/divs (no extra line breaks) [2]", "1ajd2va<blockquote><div>Line one\n\nLine two</div></blockquote>"); +add("selser", "Paragraphs inside blockquotes/divs (no extra line breaks) [[2]]", "<blockquote>\nxpf83e<div>Line one\n\nLine two</div></blockquote>"); add("selser", "Play a bit with r67090 and T5158 [0,2,1,3,0,0,1]", "<div style=\"width:50% !important\"> </div>2furaf\n<div style=\"width:50% !important\" data-foobar=\"1qc5dv3\"> </div>\n<div style=\"width:50% !important\"> </div>\n<div style=\"border : solid;\" data-foobar=\"1l7lc6r\"> </div>"); add("selser", "percent-encoding and + signs in internal links (T28410) [[[3],2,0,4,[2],3,1,0,4,4,0,0,1,0,1,3,0,3,3,3,1]]", "[[User:+%|<nowiki/>]]1knuzp0 [[Page+title%]]<nowiki/>tecpqf[[%+|mmkufk%+]][[%+|%20]] b3wipsvi8sgk[[%+r]]\n[[%]] [[+]][[File:%+abc%39|foo|[[bar]]]][[3E+]]\n"); add("selser", "T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links [2]", "19d4m8s\n\n[http://www.example.org/ ideograms]"); -- To view, visit https://gerrit.wikimedia.org/r/381380 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4a8544c6de2b4598e4d5be60c8f54d6945db970a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Arlolra <abrea...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits