Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/92554


Change subject: WIP: Bunch of tweaks and fixes to selser/wt2wt sep handling
......................................................................

WIP: Bunch of tweaks and fixes to selser/wt2wt sep handling

* Found one set of selser test regressions that needs fixing.
* Need to add comments explaining some of the changes.

Change-Id: I22d64d10105087eb2fafda1c40512a3bcea777d2
---
M js/lib/mediawiki.DOMUtils.js
M js/lib/mediawiki.WikitextSerializer.js
M js/tests/parserTests-blacklist.js
M js/tests/parserTests.txt
4 files changed, 78 insertions(+), 55 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/54/92554/1

diff --git a/js/lib/mediawiki.DOMUtils.js b/js/lib/mediawiki.DOMUtils.js
index af47ecb..e2ffb9d 100644
--- a/js/lib/mediawiki.DOMUtils.js
+++ b/js/lib/mediawiki.DOMUtils.js
@@ -708,7 +708,7 @@
 
        currentDiffMark: function(node, env) {
                if (!node || !this.isElt(node)) {
-                       return false;
+                       return null;
                }
                if ( !( node.data && node.data["parsoid-diff"] ) ) {
                        this.loadDataAttrib(node, "parsoid-diff");
@@ -754,8 +754,10 @@
        setDiffMark: function(node, env, change) {
                var dpd = this.getJSONAttribute(node, 'data-parsoid-diff', 
null);
                if (dpd !== null && dpd.id === env.page.id) {
-                       // Diff is up to date, append this change
-                       dpd.diff.push(change);
+                       // Diff is up to date, append this change if it doesn't 
already exist
+                       if (dpd.diff.indexOf(change) === -1) {
+                               dpd.diff.push(change);
+                       }
                } else {
                        // Was an old diff entry or no diff at all, reset
                        dpd = {
diff --git a/js/lib/mediawiki.WikitextSerializer.js 
b/js/lib/mediawiki.WikitextSerializer.js
index e355af2..a624bba 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -3420,6 +3420,8 @@
                        // return src, and drop the generated content
                        return {
                                handle: function() {
+                                       // FIXME: Should this also check for 
tabs and plain space chars
+                                       // interspersed with newlines?
                                        if (dp.src.match(/^\n+$/)) {
                                                state.sep.src = (state.sep.src 
|| '') + dp.src;
                                        } else {
@@ -3720,7 +3722,7 @@
 WSP.makeSeparator = function(sep, nlConstraints, state) {
        var origSep = sep;
 
-               // TODO: Move to Util?
+       // TODO: Move to Util?
        var commentRe = '<!--(?:[^-]|-(?!->))*-->',
                // Split on comment/ws-only lines, consuming subsequent 
newlines since
                // those lines are ignored by the PHP parser
@@ -3738,8 +3740,15 @@
 
        if (minNls > 0 && sepNlCount < minNls) {
                // Append newlines
+               var nlBuf = [];
                for (var i = 0; i < (minNls - sepNlCount); i++) {
-                       sep += '\n';
+                       nlBuf.push('\n');
+               }
+
+               if (nlConstraints.constraintInfo.sepType === 'parent-child') {
+                       sep = nlBuf.join('') + sep;
+               } else {
+                       sep = sep + nlBuf.join('');
                }
        } else if (nlConstraints.max !== undefined && sepNlCount > 
nlConstraints.max) {
                // Strip some newlines outside of comments
@@ -3784,7 +3793,7 @@
        // below that fails.
        //
        // Ex: "<div>foo</div>\n <span>bar</span>"
-       if (nlConstraints.min > 0 && 
sep.match(/[^\n<>]+(<!--(?:[^\-]|-(?!->))*-->[^\n]*)?$/g)) {
+       if (nlConstraints.min > 0 && sep.match(/ 
+(<!--(?:[^\-]|-(?!->))*-->[^\n]*)?$/g)) {
                // 'sep' is the separator before 'nodeB' and it has leading 
spaces on a newline.
                // We have to decide whether that leading space will trigger 
indent-pres in wikitext.
                // The decision depends on where this separator will be emitted 
relative
@@ -3843,7 +3852,7 @@
                if (!isIndentPreSafe) {
                        // Strip non-nl ws from last line, but preserve 
comments.
                        // This avoids triggering indent-pres.
-                       sep = 
sep.replace(/[^\n>]+(<!--(?:[^\-]|-(?!->))*-->[^\n]*)?$/g, '$1');
+                       sep = sep.replace(/ 
+(<!--(?:[^\-]|-(?!->))*-->[^\n]*)?$/g, '$1');
                }
        }
 
@@ -4130,12 +4139,18 @@
        }
 };
 
-WSP._getPrevSeparatorElement = function (node, state) {
+WSP._getPrevSeparatorElement = function (node) {
        return DU.previousNonSepSibling(node) || node.parentNode;
 };
 
 WSP._getNextSeparatorElement = function (node) {
        return DU.nextNonSepSibling(node) || node.parentNode;
+};
+
+WSP._selserSerializable = function(node) {
+       return DU.isElt(node) &&
+               !DU.isMarkerMeta(node, "mw:DiffMarker") &&
+               !DU.hasCurrentDiffMark(node, this.env);
 };
 
 /**
@@ -4167,8 +4182,10 @@
                        var dp = node.data.parsoid;
                        dp.dsr = dp.dsr || [];
 
+                       prev = this._getPrevSeparatorElement(node);
+                       next = this._getNextSeparatorElement(node);
+
                        // Update separator constraints
-                       prev = this._getPrevSeparatorElement(node, state);
                        var domHandler = this._getDOMHandler(node, state, cb);
                        if (prev) {
                                this.updateSeparatorConstraints(state,
@@ -4203,13 +4220,13 @@
                                        // node will go through non-selser 
serialization.
                                        var src = state.getOrigSrc(dp.dsr[0], 
dp.dsr[1]),
                                                out = src,
-                                               stripLeading = 
!DU.isIndentPre(node) && DU.hasCurrentDiffMark(node.previousSibling, this.env),
-                                               stripTrailing = 
DU.hasCurrentDiffMark(node.nextSibling, this.env),
+                                               stripLeading = 
!DU.isIndentPre(node) && !this._selserSerializable(prev),
+                                               stripTrailing = 
!this._selserSerializable(next),
                                                newSep = '',
                                                offset = 0;
 
                                        if (stripLeading) {
-                                               var leadingSepMatch = 
out.match(/^((?:\s|<!--([^\-]|-(?!->))*-->)+)/);
+                                               var leadingSepMatch = 
out.match(/^(\n(?:\s|<!--([^\-]|-(?!->))*-->)*)/);
                                                if (leadingSepMatch) {
                                                        state.sep.src = 
(state.sep.src || '') + leadingSepMatch[0];
                                                        offset = 
leadingSepMatch[0].length;
@@ -4218,7 +4235,7 @@
                                                }
                                        }
                                        if (stripTrailing) {
-                                               var trailingSepMatch = 
out.match(/((?:\s|<!--([^\-]|-(?!->))*-->)+)$/);
+                                               var trailingSepMatch = 
out.match(/(\n(?:\s|<!--([^\-]|-(?!->))*-->)*)$/);
                                                if (trailingSepMatch) {
                                                        newSep = 
trailingSepMatch[0];
                                                        out = out.substring(0, 
trailingSepMatch.index);
@@ -4248,8 +4265,8 @@
                                        // console.warn("USED ORIG");
                                        this.trace("ORIG-src:", src, '; out:', 
out);
                                        cb(out, node);
-                                       handled = true;
 
+                                       // Update stripped trailing separator 
AFTER emitting output for this node
                                        state.sep.src = (state.sep.src || '') + 
newSep;
 
                                        // Skip over encapsulated content since 
it has already been serialized
@@ -4257,6 +4274,8 @@
                                        if 
(/(?:^|\s)mw:(?:Transclusion(?=$|\s)|Param(?=$|\s)|Extension\/[^\s]+)/.test(typeOf))
 {
                                                nextNode = 
DU.skipOverEncapsulatedContent(node);
                                        }
+
+                                       handled = true;
                                } else if (DU.onlySubtreeChanged(node, 
this.env) &&
                                        hasValidTagWidths(dp.dsr) &&
                                        // In general, we want to avoid nodes 
with auto-inserted start/end tags
@@ -4298,24 +4317,21 @@
                        }
 
                        // Update end separator constraints
-                       if (node && node.nodeType === node.ELEMENT_NODE) {
-                               next = this._getNextSeparatorElement(node);
-                               if (next) {
-                                       this.updateSeparatorConstraints(state,
-                                                       node, domHandler,
-                                                       next, 
this._getDOMHandler(next, state, cb));
-                               }
+                       if (next) {
+                               this.updateSeparatorConstraints(state,
+                                               node, domHandler,
+                                               next, this._getDOMHandler(next, 
state, cb));
                        }
 
                        break;
                case node.TEXT_NODE:
-                       if (state.selserMode) {
+                       if (true || state.selserMode) {
                                this.trace("TEXT: ", node.nodeValue);
                        }
 
                        if (!this.handleSeparatorText(node, state)) {
                                // Text is not just whitespace
-                               prev = this._getPrevSeparatorElement(node, 
state);
+                               prev = this._getPrevSeparatorElement(node);
                                if (prev) {
                                        this.updateSeparatorConstraints(state,
                                                        prev, 
this._getDOMHandler(prev, state, cb),
@@ -4333,7 +4349,7 @@
                        }
                        break;
                case node.COMMENT_NODE:
-                       if (state.selserMode) {
+                       if (true || state.selserMode) {
                                this.trace("COMMENT: ", node.nodeValue);
                        }
 
diff --git a/js/tests/parserTests-blacklist.js 
b/js/tests/parserTests-blacklist.js
index 9934eb6..6071388 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -2163,13 +2163,15 @@
 
 
 // Blacklist for selser
+add("selser", "Paragraphs with extra newline spacing [3,0,4,3,0,4,1,4,3,0]", 
"\ny0o57rxsw7ki6bt9\n\nbaz\n\n\n\nbooz");
+add("selser", "Paragraphs with extra newline spacing [3,4,3,0,0,3,2,0,0,[3]]", 
"\nbaz\n\nju7o1ol49ehtzkt9\n\n\n\nbooz");
 add("selser", "Paragraphs with extra newline spacing 
[[2],0,1,0,2,0,[3],0,3,[3]]", 
"foo\n\nbar\n\nh9tjlgp8vnqgds4i\n\nbaz\n\n\n\nbooz");
-add("selser", "Paragraphs with newline spacing with comment lines in between 
[4,4,[4,3,0],0,0,2,0,4,2,3,[3,4,3,3,3,4,3],3,0,2,0,0,4,3,4,0,2,3,0,0,0,2,4,3,4,0,[2],2,0,0,[0,2],0,4,3,4,0,2,4,1]",
 "ljtjoaz8zci8uxr\n\na\n<!--foo-->\nb\n----\na\n<!--foo--><!--More than 1 
comment, still stripped-->\nb\nr7klgjd9kevfs9k9\n----\na\n <!--foo--> <!----> 
<!-- bar --> 
\nb\n----\na\n<!--foo-->\n\nk60g8c3n2dzehfr\ntasxmhs9hhorms4i\n----\na\n\n<!--foo-->\n10rd64fsf62sm7vi\ne6wd624e8gwah5mi\n\na\n<!--foo-->\n\n\nb\nr0g0rec4gfkwqaor\nx982rufrsirafw29\n\no99dl93h9hi1kyb9\n<!--foo-->\n\nb\n----");
+add("selser", "Paragraphs with newline spacing with comment lines in between 
[4,4,[4,3,0],0,0,2,0,4,2,3,[3,4,3,3,3,4,3],3,0,2,0,0,4,3,4,0,2,3,0,0,0,2,4,3,4,0,[2],2,0,0,[0,2],0,4,3,4,0,2,4,1]",
 "ljtjoaz8zci8uxr\n\na\n<!--foo-->\nb\n----\na\n<!--foo--><!--More than 1 
comment, still stripped-->\nb\nr7klgjd9kevfs9k9\n----\na\n <!--foo--> <!----> 
<!-- bar --> 
\nb\n----\na\n<!--foo-->\n\nk60g8c3n2dzehfr\ntasxmhs9hhorms4i\n----\na\n\n<!--foo-->\n10rd64fsf62sm7vi\ne6wd624e8gwah5mi\n\na\n<!--foo-->\n\n\nb\nr0g0rec4gfkwqaor\nx982rufrsirafw29\n\no99dl93h9hi1kyb9\n\n<!--foo-->\nb\n----");
 add("selser", "Paragraphs with newline spacing with comment lines in between 
[4,3,3,0,3,2,[0,4,0,0],0,0,0,[3,0,2,0,0,0,0],2,2,0,4,0,4,0,[2],0,2,0,[3],0,0,0,2,0,0,0,0,3,2,0,2,2,3,2,2,2,1,3,0]",
 "qwuk251deptlnmi\n\na\n<!--foo--><!--More than 1 comment, still 
stripped-->\nb\n----\na\n <!--foo--> <!----> <!-- bar --> 
\nb\ntydlz5t1d5n1xlxr\n----\nuv9wy6qcw9ffajor\n<!--foo-->\n\nb\nhj9wzjyvrlzncdi\n----\na\n\n<!--foo-->\nu167su9eutprpb9\n\nb\n----\na\n<!--foo-->\n\ni1bmmqztg4tmlsor\n\nb\n\nfqnjknsq13gzaor\n\na\n\n\n<!--foo-->\nb\n----");
 add("selser", "Paragraphs with newline spacing with comment lines in between 
[1,2,3,0,0,2,[3,3,0,0],2,0,0,[4,0,4,0,0,4,3],4,0,3,1,3,4,0,[3],0,0,2,2,3,0,0,[2],0,3,0,[3],2,0,0,2,0,0,4,3,0,4,2,0]",
 "----\n\n----\na\n<!--foo--><!--More than 1 comment, still 
stripped-->\nb\n----\na\n <!--foo--> <!----> <!-- bar --> 
\nb\n----\na\n<!--foo-->\n\nb\n----\nxmdcnktwnrduc8fr\n\na\n\n<!--foo-->\nb\n\na\n<!--foo-->\n\n4cetv3h5dc102j4i\n\nb\n----\n\nq7s1a16fqty5jyvi\n----");
 add("selser", "Paragraphs with newline spacing with comment lines in between 
[2,0,[2,0,0],0,4,3,1,0,2,0,3,2,4,4,4,2,3,4,0,2,3,4,0,0,0,0,0,3,1,0,4,2,2,2,[0,3],0,4,0,4,0,4,2,0]",
 
"mj5gzuujkih08uxr\n----\na\n<!--foo-->\nb\neoees9ji2i8gp66r\n\na\n<!--foo--><!--More
 than 1 comment, still 
stripped-->\nb\nm4p8awza8abxogvi\n----\n\n9pkvurf3qvlyds4i\ny983hb7zvqeka9k9\n<!--foo-->\n\nb\n\na\n\n<!--foo-->\nb\n----\n0jmda4avpldi\n<!--foo-->\n\nb\n35p3nw47r9ttke29\nqwtu1j7iaspds4i\n\na7udsdq76sa9vn29\n----");
-add("selser", "Paragraphs with newline spacing with comment lines in between 
[0,0,2,0,0,3,0,0,4,0,[4,0,2,0,0,0,3],0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,[2],0,2,0,3,0,0,4,2,3,3,2,0,4,2,0,2]",
 "----\nbfub8rvsmvjnstt9\n\na\n<!--foo-->\nb\n----\na\n<!--foo--><!--More than 
1 comment, still stripped-->\nb\nkda2g4zcxrw1att9\n\na\n <!--foo--> <!----> 
<!-- bar --> 
\nb\n----\na\n<!--foo-->\n\nmw6ahifhtg6fajor\n\nb\n----\n\n\n<!--foo-->b\nz1dg54spiuqbbj4i\n----\n\n<!--foo-->\ndyvcs6twb19n3ik9\n\nb\n\na\n\nab2ytlg8p7h0vn29\n<!--foo-->\n\nb\nqqbgbou61twt57b9\n----");
-add("selser", "Paragraphs with newline spacing with comment lines in between 
[0,0,[2,2,3],0,3,3,0,0,2,4,[0,0,3,2,2,0,2],2,3,4,1,4,0,0,[3],0,2,4,2,2,4,4,0,0,0,0,2,0,2,2,1,3,1,3,4,2,2,0,0]",
 "----\na\n<!--foo-->\nb\n\na\n<!--foo--><!--More than 1 comment, still 
stripped-->\nb\n85jfjh6sy4g3nmi\n----\na\n <!--foo--> <!----> <!-- bar --> 
\nb\n\na\n<!--foo-->\n\nb\n5kkv42nccys0pb9\n----\nem14mo86i3a6ecdi\n\na\n\n<!--foo-->\nb\n----\nffdscihc6jl15rk9\n\na\n<!--foo-->\n\n\nb\n----\n5224udoqvgm5z5mi\n\nsosmbdqy8omndn29\n<!--foo-->\n\nb\n----");
+add("selser", "Paragraphs with newline spacing with comment lines in between 
[0,0,2,0,0,3,0,0,4,0,[4,0,2,0,0,0,3],0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,[2],0,2,0,3,0,0,4,2,3,3,2,0,4,2,0,2]",
 "----\nbfub8rvsmvjnstt9\n\na\n<!--foo-->\nb\n----\na\n<!--foo--><!--More than 
1 comment, still stripped-->\nb\nkda2g4zcxrw1att9\n\na\n <!--foo--> <!----> 
<!-- bar --> 
\nb\n----\na\n<!--foo-->\n\nmw6ahifhtg6fajor\n\nb\n----\n\n\n<!--foo-->b\nz1dg54spiuqbbj4i\n----\n\n<!--foo-->\ndyvcs6twb19n3ik9\n\nb\n\na\n\nab2ytlg8p7h0vn29\n\n<!--foo-->\nb\nqqbgbou61twt57b9\n----");
+add("selser", "Paragraphs with newline spacing with comment lines in between 
[0,0,[2,2,3],0,3,3,0,0,2,4,[0,0,3,2,2,0,2],2,3,4,1,4,0,0,[3],0,2,4,2,2,4,4,0,0,0,0,2,0,2,2,1,3,1,3,4,2,2,0,0]",
 "----\na\n<!--foo-->\nb\n\na\n<!--foo--><!--More than 1 comment, still 
stripped-->\nb\n85jfjh6sy4g3nmi\n----\na\n <!--foo--> <!----> <!-- bar --> 
\nb\n\na\n<!--foo-->\n\nb\n5kkv42nccys0pb9\n----\nem14mo86i3a6ecdi\n\na\n\n<!--foo-->\nb\n----\nffdscihc6jl15rk9\n\na\n<!--foo-->\n\n\nb\n----\n5224udoqvgm5z5mi\n\nsosmbdqy8omndn29\n\n<!--foo-->\nb\n----");
 add("selser", "Paragraphs with newline spacing with comment lines in between 
[0,0,[3,0,2],0,0,0,[0,0,3,2],3,0,3,3,0,3,3,3,2,3,0,4,0,0,3,0,3,0,2,4,0,0,0,[3],0,3,3,2,3,0,0,[3],0,0,0,3]",
 "----\na\n<!--foo-->\nb\n----\na\n<!--foo--><!--More than 1 comment, still 
stripped-->\nb\n----\n\n\n<!--foo-->8rw9av9qj4dq85mi\n----\na\n\n<!--foo-->\ndu6jt61okzr7wrk9\n----\na\n<!--foo-->\n\n1jh3zxyk0n7sc3di\n\nb\n----\na\n\n\n<!--foo-->\nb\n");
 add("selser", "Paragraphs with newline spacing with comment lines in between 
[0,3,3,2,4,0,3,2,4,3,[0,3,4,0,0,2,0],4,0,0,1,0,0,2,2,3,0,3,0,0,3,0,4,3,2,2,4,4,4,0,3,2,0,0,4,0,0,0,0]",
 "----\n\n6gx1kaqkfuutmx6r\n\n0k799c2kjmh4obt9\n\na\n <!--foo--> <!----> <!-- 
bar --> 
\nb\n----\na\n<!--foo-->\n\nkrpmowva2u0rizfr\n\nb\n----\na\n\n<!--foo-->\nq7ha13n9928g2e29\nmprjuqo5nhlg14i\n----\nijohlqni84yam7vi\n<!--foo-->\n\n----\n7wcbe6fe7fp6i529\n\n\n<!--foo-->b\n----");
 add("selser", "Paragraphs with newline spacing with non-empty white-space 
lines in between [0,3,[4],3,0,3,0,3,2,0,2,3,0]", "----\na\n 
\nb\n----\nbrykj4fg3gv0wwmi\n\na\n \n l7ckrodi12fyldi\n\nb\n----");
@@ -2181,6 +2183,7 @@
 add("selser", "Paragraphs with newline spacing with non-empty mixed comment 
and white-space lines in between 
[0,0,2,0,0,3,4,0,0,0,1,3,0,0,3,3,[4],0,2,2,0,2,2,0,0,4,2,3,4]", 
"----\n7olsh4jwmsbmaemi\n\na\n <!--foo-->\nb\n----\nfjw5y0q50lwstt9\n----\na\n 
\n<!--foo-->\n <!--bar-->\nb\njwhdk8g1hmj6pqfr\n----\na\n \n <!--foo-->\n 
<!--bar-->\n pik29nchxdo647vi\n\nb\nac7itfndip9tqpvi");
 add("selser", "Extra newlines: More paragraphs with indented comment 
[1,0,4,0,2]", "a\n\n   <!--boo-->\n1y1i1on0frr1wcdi\n\nb");
 add("selser", "Extra newlines: More paragraphs with indented comment 
[[2],3,4,2,2]", "a\n\n   <!--boo-->\nby86nk60sg36jemi\n\nb");
+add("selser", "Extra newlines: More paragraphs with indented comment 
[3,4,0,2,0]", "\n\n   <!--boo-->b");
 add("selser", "Extra newlines: More paragraphs with indented comment 
[0,3,0,4,2]", "a\n\n   <!--boo-->\n8ycptp4m6awi2j4i\n\nb");
 add("selser", "Italics and possessives (1) [1]", "obtained by ''[[Lunar 
Prospector]]'''s gamma-ray spectrometer");
 add("selser", "Italics and possessives (1) [2]", "mylboba6mj3v7vi\n\nobtained 
by ''[[Lunar Prospector]]'''s gamma-ray spectrometer");
@@ -2416,8 +2419,6 @@
 add("selser", "Comment semantics: unclosed comment at end [3]", "<!--This 
comment will run out to the end of the document");
 add("selser", "Comment semantics: unclosed comment at end [4]", "<!--This 
comment will run out to the end of the document");
 add("selser", "Comment semantics: unclosed comment at end [2]", "<!--This 
comment will run out to the end of the document");
-add("selser", "Tabs don't trigger preformatted text [2,2,[2]]", 
"l7wt6v8iaiwzh0k9\t\n\nThis is not\n\t preformatted text.\n This is 
preformatted text.\n \tSo is this.");
-add("selser", "Tabs don't trigger preformatted text [2,0,0]", 
"pgtgiah3b7f1or\t\n\nThis is not\n\t preformatted text.\n This is preformatted 
text.\n \tSo is this.");
 add("selser", "<nowiki> inside <pre> (bug 13238) [4,2,2,0,0]", 
"ptjux9vq9zarlik9\ny7rebotz1jo1dcxr<pre>\n<nowiki></nowiki>\n</pre>\n<pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>");
 add("selser", "<nowiki> inside <pre> (bug 13238) [0,0,4,0,[[4],0,2,4]]", 
"<pre>\n<nowiki>\n</pre>\n4bu012lyu5l8fr\n<pre><nowiki><nowiki></nowiki>Foo3iwsls5l4dzhbyb9<nowiki></nowiki></nowiki></pre>");
 add("selser", "<nowiki> inside <pre> (bug 13238) [3,0,3,3,2]", 
"\np32i6amoddb9y66r<pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>");
@@ -2453,7 +2454,7 @@
 add("selser", "6. Pre-blocks should extend across lines with leading WS even 
when there is no wrappable content [[2,0,2],0,[4],2,0]", " a\n \n <!-- continue 
-->\n b\n\n c\n \nd");
 add("selser", "6. Pre-blocks should extend across lines with leading WS even 
when there is no wrappable content [[0,2,0],4,[4],3,[4]]", " a\n \n <!-- 
continue -->\n b\n\n c\n \nd");
 add("selser", "6. Pre-blocks should extend across lines with leading WS even 
when there is no wrappable content [[0,4,4],0,1,4,[3]]", " a\n \n <!-- continue 
-->\n b\n\n c\n \nd");
-add("selser", "6. Pre-blocks should extend across lines with leading WS even 
when there is no wrappable content [[0,0,2],0,4,0,[2]]", " a\n \n <!-- continue 
-->\n b\n\ndhs1camce301wcdi \n\nd");
+add("selser", "6. Pre-blocks should extend across lines with leading WS even 
when there is no wrappable content [[0,0,2],0,4,0,[2]]", " a\n \n <!-- continue 
-->\n b\n\ndhs1camce301wcdi\n \nd");
 add("selser", "6. Pre-blocks should extend across lines with leading WS even 
when there is no wrappable content [2,0,1,0,[3]]", "opfgacofr6rh33di\n a\n \n 
<!-- continue -->\n b\n\n c\n \nd");
 add("selser", "6. Pre-blocks should extend across lines with leading WS even 
when there is no wrappable content [0,2,0,0,0]", " a\n \n <!-- continue -->\n 
b\n\n c\n \nd");
 add("selser", "6. Pre-blocks should extend across lines with leading WS even 
when there is no wrappable content [2,4,0,0,3]", "iinv6rmhb9e8kt9\n a\n \n <!-- 
continue -->\n b\n\n c \n");
@@ -2479,8 +2480,6 @@
 add("selser", "HTML-pre: 1. embedded newlines [0,4,0,2,0,0,1]", 
"<pre>foo</pre>\n\n<pre>\nfoo\n</pre>\n\n<pre>\n\nfoo\n</pre>\n\n<pre 
data-foobar=\"bvrbszgeukgldi\">\n\n\n\nfoo\n</pre>");
 add("selser", "HTML-pre: 1. embedded newlines [0,0,[2],3,0,4,4]", 
"<pre>foo</pre>\n\n<pre>\nfoo\n</pre>\n\n<pre>\n\nfoo\n</pre>\n\ne0n9rheg4wapp66r");
 add("selser", "HTML-pre: 1. embedded newlines [0,3,[4],3,0,3,[2]]", 
"<pre>foo</pre>\n\n<pre>\nfoo\n</pre>\n\n<pre>\n\nfoo\n</pre>\n\n<pre>\n\n\nfoo\n</pre>");
-add("selser", "Definition list with URL link [[1,0]]", "; http://example.com/: 
definition");
-add("selser", "Definition list with URL link [[1,[3]]]", "; 
http://example.com/: definition");
 add("selser", "Definition lists: self-closed tag [2]", 
"x14l42v2vh392j4i\n;one<br/>two : two-line fun");
 add("selser", "Definition lists: self-closed tag [1]", ";one<br/>two : 
two-line fun");
 add("selser", "Definition lists: self-closed tag [[[4,2,4,0],[2]]]", 
";onehfmudey4je6u5wmi<br/>two : two-line fun");
@@ -2742,14 +2741,16 @@
 add("selser", "Table td-cell syntax variations [1]", "{| 
data-foobar=\"ripzux1o66crf6r\"\n| foo bar foo | baz\n| foo bar foo || baz\n| 
style='color:red;' | baz\n| style='color:red;' || baz\n|}");
 add("selser", "Table td-cell syntax variations [[3,[2,0]]]", 
"{|\n<!--aerzm44cpngynwmi-->| foo bar foo | baz\n| foo bar foo || baz\n| 
style='color:red;' | baz\n| style='color:red;' || baz\n|}");
 add("selser", "Table td-cell syntax variations [[2,1]]", "{|\n| foo bar foo | 
baz\n| foo bar foo || baz\n| style='color:red;' | baz\n| style='color:red;' || 
baz\n|}");
-add("selser", "Table td-cell syntax variations 
[[0,[[1,0,[4],2,2,[4],0,[3],0],0]]]", "{|\n| data-foobar=\"wbzm28qubtb4vx6r\" 
foo bar | baz\n| foo bar foo <!--bop4r1vr91itfbt9-->|| baz\n| 
style='color:red;' | baz\n| style='color:red;' || baz\n|}");
-add("selser", "Table td-cell syntax variations 
[[4,[[2,0,2,[3],4,0,3,[3],1],2]]]", "{|\n<!--mz3xyunmkehwu3di-->\n| foo bar foo 
| baz\n| foo bar foo || baz\n| style='color:red;' | baz\n| style='color:red;' 
|| data-foobar=\"l0hmwng5zji9hpvi\" | baz\n|}");
+add("selser", "Table td-cell syntax variations 
[[0,[[1,0,[4],2,2,[4],0,[3],0],0]]]", "{|\n| data-foobar=\"wbzm28qubtb4vx6r\" 
foo bar | baz\n| foo bar foo || baz\n| style='color:red;' | baz\n| 
style='color:red;' || baz\n|}");
+add("selser", "Table td-cell syntax variations 
[[4,[[2,0,2,[3],4,0,3,[3],1],2]]]", "{|\n\n<!--mz3xyunmkehwu3di-->| foo bar foo 
| baz\n| foo bar foo || baz\n| style='color:red;' | baz\n| style='color:red;' 
|| data-foobar=\"l0hmwng5zji9hpvi\" | baz\n|}");
 add("selser", "Table td-cell syntax variations [[0,[[4,0,0,1,0,0,0,4,4],0]]]", 
"{|\n<!--juve1nh5fs4kuik9-->\n| foo bar foo || data-foobar=\"v00hdvjl3int57b9\" 
| baz\n| style='color:red;' | 
baz\n<!--6x3dng4d2qehfr--><!--eow57cf1pgmn29-->\n|}");
 add("selser", "Table td-cell syntax variations [[0,[1,4]]]", "{|\n| foo bar 
foo | baz\n| foo bar foo || baz\n| style='color:red;' | baz\n| 
style='color:red;' || baz\n|}");
-add("selser", "Table td-cell syntax variations [[0,[[1,4,0,2,2,0,4,0,0],3]]]", 
"{|\n| data-foobar=\"yapr5vvoeskk2o6r\" foo bar | baz\n| foo bar foo 
<!--n59kxzdkg0dg3nmi-->|| baz\n| style='color:red;' | baz\n| style='color:red;' 
|| baz\n|}");
+add("selser", "Table td-cell syntax variations [[0,[[1,4,0,2,2,0,4,0,0],3]]]", 
"{|\n| data-foobar=\"yapr5vvoeskk2o6r\" foo bar | baz\n| foo bar foo || baz\n| 
style='color:red;' | baz\n| style='color:red;' || baz\n|}");
 add("selser", "Table td-cell syntax variations [[0,2]]", 
"{|\n<!--uiyg1xnqf84u0udi-->| foo bar foo | baz\n| foo bar foo || baz\n| 
style='color:red;' | baz\n| style='color:red;' || baz\n|}");
+add("selser", "Simple table [[2,[[2,2],4,3,2]]]", 
"{|\n\n<!--myw8tj6g2ufpqfr-->| 1 || 2\n\n|}");
 add("selser", "Multiplication table [[0,[2],2,2]]", "{| border=\"1\" 
cellpadding=\"2\"\n|+Multiplication table\n|-\n! &times; !! 1 !! 2 !! 3\n|-\n! 
1\n| 1 || 2 || 3\n|-\n! 2\n| 2 || 4 || 6\n|-\n! 3\n| 3 || 6 || 9\n|-\n! 4\n| 4 
|| 8 || 12\n|-\n! 5\n| 5 || 10 || 15\n|}");
-add("selser", "Multiplication table 
[[4,1,4,[[0,[0,1,4],3,1,0],0,2,0,1,0,[0,2,2,2,2,[2]],0,3,0,[4,0,0,3,0,4],0]]]", 
"{| border=\"1\" cellpadding=\"2\"\n|+ data-foobar=\"t57h9ymm47m8to6r\" 
|Multiplication table\n|-\n! &times; !! data-foobar=\"2d6yfgysmtervn29\" | 2 !! 
3\n|-\n! 1\n| 1 || 2 || 3\n|- data-foobar=\"p8wukztcsor\"\n! 2\n| 2 || 4 || 
6\n|-\n<!--z4x3tc8wjojvpldi-->! 3\n| 3 <!--45occllzgehr529-->|| 6 || 9\n\n|-\n! 
5\n|| 10 <!--rpawa6o0v902uik9-->\n|}");
+add("selser", "Multiplication table 
[[4,1,4,[[0,[0,1,4],3,1,0],0,2,0,1,0,[0,2,2,2,2,[2]],0,3,0,[4,0,0,3,0,4],0]]]", 
"{| border=\"1\" cellpadding=\"2\"\n|+ data-foobar=\"t57h9ymm47m8to6r\" 
|Multiplication table\n|-\n! &times; !! data-foobar=\"2d6yfgysmtervn29\" | 2 !! 
3\n|-\n! 1\n| 1 || 2 || 3\n|- data-foobar=\"p8wukztcsor\"\n! 2\n| 2 || 4 || 
6\n|-\n<!--z4x3tc8wjojvpldi-->! 3\n| 3 || 6 || 9\n\n|-\n! 5\n|| 10 
<!--rpawa6o0v902uik9-->\n|}");
+add("selser", "Accept \"||\" in table headings [[2,[[[2],2],4]]]", "{|\n!h1 || 
h2\n|}");
 add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [[4,[[0,0,4,3],4,[2,4,[2],[3],2,[3],[2],1],3,4,0]]]", 
"{|\n|-\n|style='color:red;'|+1\n\n|-\n<!--ey69w1huzxhl4n29-->|| 2 || 3\n| 1 
||+2 || data-foobar=\"9tw49jdk0u5o2yb9\" |-3\n<!--kx0w31z2r3eg66r-->\n|}");
 add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [1]", "{| 
data-foobar=\"qni1jj96d8ia4i\"\n|-\n|style='color:red;'|+1\n|style='color:blue;'|-1\n|-\n|
 1 || 2 || 3\n| 1 ||+2 ||-3\n|-\n| +1\n| -1\n|}");
 add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [2]", 
"pedhswzbj517zaor\n{|\n|-\n|style='color:red;'|+1\n|style='color:blue;'|-1\n|-\n|
 1 || 2 || 3\n| 1 ||+2 ||-3\n|-\n| +1\n| -1\n|}");
@@ -2758,11 +2759,11 @@
 add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [[2,[[0,4,0,[4]],0,1,2,[0,2,4,[2]],0]]]", 
"{|\n|-\n<!--emm9y0vb4kcpu8fr-->\n|style='color:blue;'|-1\n|- 
data-foobar=\"56yuimp8zeabgldi\"\n| 1 || 2 || 3\n| 1 ||+2 
||-3\n|-\n<!--pze9sgy470vygb9-->| +1\n| -1\n|}");
 add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [[0,2]]", 
"{|\n<!--xllkdkan97eyu8fr-->|-\n|style='color:red;'|+1\n|style='color:blue;'|-1\n|-\n|
 1 || 2 || 3\n| 1 ||+2 ||-3\n|-\n| +1\n| -1\n|}");
 add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [[3,[[3,1,0,[4]],3,4,2,[0,4,0,0],4]]]", "{|\n|-\n| style=\"color:red;\" 
data-foobar=\"cppwm0tpam7vi\" 
|+1\n|style='color:blue;'|-1\n<!--a7cowbidjazia4i-->\n|-\n<!--x62n4p612rpgy14i-->\n|
 -1\n|}");
-add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [[0,[[3,2,0,0],0,[2,0,1,[2],0,0,0,2],0,[0,[4],0,0],0]]]", 
"{|\n|-\n<!--0bez83pg3gom9529-->|style='color:red;'|+1\n|style='color:blue;'|-1\n|-\n|
 1 || data-foobar=\"sxirzpn3nq257b9\" | 2 || 3\n| 1 ||+2 
<!--27xcharybvs4i-->||-3\n|-\n| +1\n| -1\n|}");
+add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [[0,[[3,2,0,0],0,[2,0,1,[2],0,0,0,2],0,[0,[4],0,0],0]]]", 
"{|\n|-\n<!--0bez83pg3gom9529-->|style='color:red;'|+1\n|style='color:blue;'|-1\n|-\n|
 1 || data-foobar=\"sxirzpn3nq257b9\" | 2 || 3\n| 1 ||+2 ||-3\n|-\n| +1\n| 
-1\n|}");
 add("selser", "Allow +/- in 2nd and later cells in a row, in 1st cell when 
td-attrs are present, or in 1st cell when there is a space between \"|\" and 
+/-  [[2,[[3,[2],4,3],2,[4,2,0,0,2,3,4,2],0,2,0]]]", 
"{|\n|-\n|style='color:red;'|+1\n\n|-\n<!--c52xl586woob6gvi-->| 1 || 2 || 
3\n<!--pd4he20jr8vndn29--><!--o18agxlnddmo0f6r-->||-3\n|-\n| +1\n| -1\n|}");
 add("selser", "Table rowspan [[3,2]]", "{| 
border=\"1\"\n<!--dw212cp9esif6r-->| Cell 1, row 1\n|rowspan=2| Cell 2, row 1 
(and 2)\n| Cell 3, row 1\n|-\n| Cell 1, row 2\n| Cell 3, row 2\n|}");
 add("selser", "Table rowspan [[0,1]]", "{| border=\"1\"\n| Cell 1, row 
1\n|rowspan=2| Cell 2, row 1 (and 2)\n| Cell 3, row 1\n|-\n| Cell 1, row 2\n| 
Cell 3, row 2\n|}");
-add("selser", "Table rowspan [[2,[[2,0,3,0,4],0,[0,0,0,3],2]]]", "{| 
border=1\n<!--hf5z89mzkeh77gb9-->\n| Cell 1, row 
1\n\n<!--4j3mbmbko7gmn29-->\n|-\n| Cell 1, row 2\n\n|}");
+add("selser", "Table rowspan [[2,[[2,0,3,0,4],0,[0,0,0,3],2]]]", "{| 
border=1\n\n<!--hf5z89mzkeh77gb9-->| Cell 1, row 
1\n\n<!--4j3mbmbko7gmn29-->\n|-\n| Cell 1, row 2\n\n|}");
 add("selser", "Table rowspan [2]", "xb37vwsdil6gk3xr\n{| border=1\n| Cell 1, 
row 1\n|rowspan=2| Cell 2, row 1 (and 2)\n| Cell 3, row 1\n|-\n| Cell 1, row 
2\n| Cell 3, row 2\n|}");
 add("selser", "Table rowspan [1]", "{| border=\"1\" 
data-foobar=\"xgpmrwgiugpbvs4i\"\n| Cell 1, row 1\n|rowspan=2| Cell 2, row 1 
(and 2)\n| Cell 3, row 1\n|-\n| Cell 1, row 2\n| Cell 3, row 2\n|}");
 add("selser", "Table rowspan [[0,[1,0,2,0]]]", "{| border=1\n| Cell 1, row 
1\n|rowspan=2| Cell 2, row 1 (and 2)\n| Cell 3, row 
1\n<!--esqo19m7kv620529-->|-\n| Cell 1, row 2\n| Cell 3, row 2\n|}");
@@ -2788,7 +2789,7 @@
 add("selser", "Nested table [[0,[[1,2,[3,4],0,4],2]]]", "{| border=1\n| 
data-foobar=\"rvxj3ybmjcl680k9\" | 
&alpha;\n|\nhk2lwgso9gvz33di\n<!--nqxaiu7b5cngsyvi-->\n|}");
 add("selser", "Nested table [[0,[1,2]]]", "{| border=1\n| &alpha;\n|\n{| 
bgcolor=#ABCDEF border=2\n|nested\n|-\n|table\n|}\n|the original table 
again\n|}");
 add("selser", "Nested table [[0,1]]", "{| border=\"1\"\n| &alpha;\n|\n{| 
bgcolor=#ABCDEF border=2\n|nested\n|-\n|table\n|}\n|the original table 
again\n|}");
-add("selser", "Nested table [[0,[[2,0,[4,[0,[0,0,[0,3],2]]],0,0],4]]]", "{| 
border=1\n<!--2cpkww5viwe45cdi-->\n| &alpha;\n|\n{| bgcolor=#ABCDEF 
border=2\n|nested\n|-\n\n|}\n|the original table again\n|}");
+add("selser", "Nested table [[0,[[2,0,[4,[0,[0,0,[0,3],2]]],0,0],4]]]", "{| 
border=1\n\n<!--2cpkww5viwe45cdi-->| &alpha;\n|\n{| bgcolor=#ABCDEF 
border=2\n|nested\n|-\n\n|}\n|the original table again\n|}");
 add("selser", "Invalid attributes in table cell (bug 1830) [1]", "{| 
data-foobar=\"qjn3d6di3vcuwhfr\"\n|Cell:|broken\n|}");
 add("selser", "Invalid attributes in table cell (bug 1830) [[4,1]]", 
"{|\n|Cell:|broken\n|}");
 add("selser", "Invalid attributes in table cell (bug 1830) [2]", 
"ihzdqjdk01bp4x6r\n{|\n|Cell:|broken\n|}");
@@ -2797,7 +2798,7 @@
 add("selser", "Invalid attributes in table cell (bug 1830) [[0,1]]", 
"{|\n|Cell:|broken\n|}");
 add("selser", "Invalid attributes in table cell (bug 1830) [[0,[2,0]]]", 
"{|\n<!--j29v67hfrufmvx6r-->|Cell:|broken\n|}");
 add("selser", "Invalid attributes in table cell (bug 1830) [[2,1]]", 
"{|\n|Cell:|broken\n|}");
-add("selser", "Invalid attributes in table cell (bug 1830) [[3,[[2],0]]]", 
"{|\n<!--otq3btd8klf2yb9-->\n|Cell:|broken\n|}");
+add("selser", "Invalid attributes in table cell (bug 1830) [[3,[[2],0]]]", 
"{|\n\n<!--otq3btd8klf2yb9-->|Cell:|broken\n|}");
 add("selser", "Invalid attributes in table cell (bug 1830) [[0,[1,3]]]", 
"{|\n|Cell:|broken\n|}");
 add("selser", "Table security: embedded pipes 
(http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html) 
[2]", "m6gbpp8vyjozjjor\n{|\n| |[ftp://|x||]\" 
onmouseover=\"alert(document.cookie)\">test");
 add("selser", "Table attributes with empty value [2]", 
"ypqzbga8qxeqm2t9\n{|\n| style=| hello\n|}");
@@ -3266,7 +3267,7 @@
 add("selser", "Table attribute legitimate extension [[0,[1,4]]]", "{|\n!+ 
style=\"<nowiki>color:blue</nowiki>\"| status\n|}");
 add("selser", "Table attribute legitimate extension [2]", 
"ttlfw8y9so9wwmi\n{|\n!+ style=\"<nowiki>color:blue</nowiki>\"| status\n|}");
 add("selser", "Table attribute legitimate extension [[3,2]]", 
"{|\n<!--aj1x9jx74cjif6r-->!+ style=\"<nowiki>color:blue</nowiki>\"| 
status\n|}");
-add("selser", "Table attribute legitimate extension [[2,[[2],0]]]", 
"{|\n<!--drpses0bnhtzkt9-->\n!+ style=\"<nowiki>color:blue</nowiki>\"| 
status\n|}");
+add("selser", "Table attribute legitimate extension [[2,[[2],0]]]", 
"{|\n\n<!--drpses0bnhtzkt9-->!+ style=\"<nowiki>color:blue</nowiki>\"| 
status\n|}");
 add("selser", "Table attribute legitimate extension [1]", "{| 
data-foobar=\"ub4bg317e10v0a4i\"\n!+ style=\"<nowiki>color:blue</nowiki>\"| 
status\n|}");
 add("selser", "Table attribute legitimate extension [[0,[[[2]],2]]]", "{|\n!+ 
style=\"<nowiki>color:blue</nowiki>\"| status\n|}");
 add("selser", "Table attribute legitimate extension [[2,[1,4]]]", "{|\n!+ 
style=\"<nowiki>color:blue</nowiki>\"| status\n|}");
@@ -3491,13 +3492,13 @@
 add("selser", "Basic test for template parameter in language variants [[4]]", 
"{{парамтест|param=foo}}");
 add("selser", "Basic test for template parameter in language variants [[3]]", 
"{{парамтест|param=foo}}");
 add("selser", "Basic test for template parameter in language variants [[2]]", 
"{{парамтест|param=foo}}");
-add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[1,0]]", "****** Foo \n{{bullet}}");
-add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[[[[1]]]],0]]", "**** Foo \n{{bullet}}");
-add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[[[[[[1]]]]]],0]]", "*** Foo \n{{bullet}}");
-add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[2],0]]", "*vkl4nqq6z9kvs4i\n****** Foo \n{{bullet}}");
-add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[1],0]]", "****** Foo \n{{bullet}}");
-add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[[1]],0]]", "***** Foo \n{{bullet}}");
-add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[[2]],0]]", "**y0slrsmmchjxxbt9\n****** Foo \n{{bullet}}");
+add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[1,0]]", "****** Foo {{bullet}}");
+add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[[[[1]]]],0]]", "**** Foo {{bullet}}");
+add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[[[[[[1]]]]]],0]]", "*** Foo {{bullet}}");
+add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[2],0]]", "*vkl4nqq6z9kvs4i\n****** Foo {{bullet}}");
+add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[1],0]]", "****** Foo {{bullet}}");
+add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[[1]],0]]", "***** Foo {{bullet}}");
+add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[[[2]],0]]", "**y0slrsmmchjxxbt9\n****** Foo {{bullet}}");
 add("selser", "Case insensitivity of parser functions for non-ASCII characters 
(bug 8143) [[4]]", 
"{{PRVNÍVELKÉ:ěščř}}\n{{prvnívelké:ěščř}}\n{{PRVNÍMALÉ:ěščř}}\n{{prvnímalé:ěščř}}\n{{MALÁ:ěščř}}\n{{malá:ěščř}}\n{{VELKÁ:ěščř}}\n{{velká:ěščř}}");
 add("selser", "Case insensitivity of parser functions for non-ASCII characters 
(bug 8143) [[3]]", 
"{{PRVNÍVELKÉ:ěščř}}\n{{prvnívelké:ěščř}}\n{{PRVNÍMALÉ:ěščř}}\n{{prvnímalé:ěščř}}\n{{MALÁ:ěščř}}\n{{malá:ěščř}}\n{{VELKÁ:ěščř}}\n{{velká:ěščř}}");
 add("selser", "Case insensitivity of parser functions for non-ASCII characters 
(bug 8143) [[2]]", 
"{{PRVNÍVELKÉ:ěščř}}\n{{prvnívelké:ěščř}}\n{{PRVNÍMALÉ:ěščř}}\n{{prvnímalé:ěščř}}\n{{MALÁ:ěščř}}\n{{malá:ěščř}}\n{{VELKÁ:ěščř}}\n{{velká:ěščř}}");
@@ -3721,9 +3722,9 @@
 add("selser", "Tables: 1d. No escaping needed [2]", "|}foo");
 add("selser", "Tables: 1d. No escaping needed [3]", "|}foo");
 add("selser", "Tables: 1d. No escaping needed [4]", "|}foo");
-add("selser", "Tables: 2b. Nested in td [[2,[[2,0,2],2]]]", 
"{|\n<!--ymmlkehd43cgzaor-->\n|<nowiki>foo||bar</nowiki>\n|''it''<nowiki>foo||bar</nowiki>\n|}");
+add("selser", "Tables: 2b. Nested in td [[2,[[2,0,2],2]]]", 
"{|\n\n<!--ymmlkehd43cgzaor-->|<nowiki>foo||bar</nowiki>\n|''it''<nowiki>foo||bar</nowiki>\n|}");
 add("selser", "Tables: 4a. Escape - [[3,[2,2,2,0]]]", 
"{|\n<!--ho41crvipo8q6w29-->!-bar\n|-\n|<nowiki>-bar</nowiki>\n|}");
-add("selser", "Tables: 4c. No escaping needed 
[[4,[[2,0,[2]],0,[2,4,3,[[2],3]],2,2,2]]]", 
"{|\n<!--14nw3kacf5z8h0k9-->\n|foo-bar\n|foo+bar\n|-\n<!--g04frdxd5nrk9-->\n|''foo''+bar\n|-\n|foo\nbar|baz\n+bar\n-bar\n|}");
+add("selser", "Tables: 4c. No escaping needed 
[[4,[[2,0,[2]],0,[2,4,3,[[2],3]],2,2,2]]]", 
"{|\n\n<!--14nw3kacf5z8h0k9-->|foo-bar\n|foo+bar\n|-\n<!--g04frdxd5nrk9-->\n|''foo''+bar\n|-\n|foo\nbar|baz\n+bar\n-bar\n|}");
 add("selser", "Tables: 4c. No escaping needed 
[[0,[1,3,[0,2,4,[0,3]],0,2,4]]]", 
"{|\n|foo-bar\n|foo+bar\n|-\n<!--i9fkprk2xr4zehfr-->|''foo''-bar\n|''foo''+bar\n|-\n|foo\nbar|baz\n+bar\n-bar\n|}");
 add("selser", "Tables: 4c. No escaping needed 
[[4,[[[3],0,[2]],4,2,0,[4,1],4]]]", 
"{|\n|foo-bar\n|foo+bar\n|-\n|''foo''-bar\n|''foo''+bar\n|-\n| 
data-foobar=\"9ggj5ofujarod2t9\" |foo\nbar|baz\n+bar\n-bar\n|}");
 add("selser", "Tables: 4d. No escaping needed [[3,[[[3],3,2],4]]]", 
"{|\n||+1\n||-2\n|}");
@@ -3757,8 +3758,8 @@
 add("selser", "Table with broken attribute value quoting [[0,1]]", "{|\n| 
title=\"Hello world|Foo\n|}");
 add("selser", "Table with broken attribute value quoting [[3,[[[3]],3]]]", 
"{|\n| title=\"Hello world|Foo\n|}");
 add("selser", "Table with broken attribute value quoting [1]", "{| 
data-foobar=\"pa0vp357jvr0ms4i\"\n| title=\"Hello world|Foo\n|}");
-add("selser", "Table with broken attribute value quoting [[0,[[2],0]]]", 
"{|\n<!--wf125xn56rhsq0k9-->\n| title=\"Hello world|Foo\n|}");
-add("selser", "Table with broken attribute value quoting [[0,[[2],2]]]", 
"{|\n<!--cp6e2iwuotkjra4i-->\n| title=\"Hello world|Foo\n|}");
+add("selser", "Table with broken attribute value quoting [[0,[[2],0]]]", 
"{|\n\n<!--wf125xn56rhsq0k9-->| title=\"Hello world|Foo\n|}");
+add("selser", "Table with broken attribute value quoting [[0,[[2],2]]]", 
"{|\n\n<!--cp6e2iwuotkjra4i-->| title=\"Hello world|Foo\n|}");
 add("selser", "Table with broken attribute value quoting on consecutive lines 
[[3,1]]", "{|\n| title=\"Hello world|Foo\n| style=\"color:red|Bar\n|}");
 add("selser", "Table with broken attribute value quoting on consecutive lines 
[[3,2]]", "{|\n<!--e45oiux5ebmg3nmi-->| title=\"Hello world|Foo\n| 
style=\"color:red|Bar\n|}");
 add("selser", "Table with broken attribute value quoting on consecutive lines 
[1]", "{| data-foobar=\"r285ew8on06yldi\"\n| title=\"Hello world|Foo\n| 
style=\"color:red|Bar\n|}");
@@ -3772,7 +3773,7 @@
 add("selser", "Table with broken attribute value quoting on consecutive lines 
[[4,[[[3],0,0],0]]]", "{|\n| title=\"Hello world|Foo\n| 
style=\"color:red|Bar\n|}");
 add("selser", "Table with broken attribute value quoting on consecutive lines 
[[4,[[1,0,0],0]]]", "{|\n| title=\"Hello world\" 
data-foobar=\"nejaqckt9hmbcsor\" |Foo\n| style=\"color:red|Bar\n|}");
 add("selser", "Table with broken attribute value quoting on consecutive lines 
[[4,2]]", "{|\n<!--7wm4bxgh5f0w9udi-->| title=\"Hello world|Foo\n| 
style=\"color:red|Bar\n|}");
-add("selser", "Table with broken attribute value quoting on consecutive lines 
[[0,[[2,0,3],3]]]", "{|\n<!--fk1rjyjbpej6ecdi-->\n| title=\"Hello 
world|Foo\n\n|}");
+add("selser", "Table with broken attribute value quoting on consecutive lines 
[[0,[[2,0,3],3]]]", "{|\n\n<!--fk1rjyjbpej6ecdi-->| title=\"Hello 
world|Foo\n\n|}");
 add("selser", "Parsoid-only: Table with broken attribute value quoting on 
consecutive lines [[0,[2,0]]]", "{|\n<!--65b6dlogs124kj4i-->| title=\"Hello 
world|Foo\n| style=\"color:red|Bar\n|}");
 add("selser", "Parsoid-only: Table with broken attribute value quoting on 
consecutive lines [[0,[[[3],2,4],0]]]", "{|\n| title=\"Hello 
world|Foo\n<!--b1qbp0ow2dszto6r-->\n|}");
 add("selser", "Parsoid-only: Table with broken attribute value quoting on 
consecutive lines [1]", "{| data-foobar=\"xgsbz2z4izlg14i\"\n| title=\"Hello 
world|Foo\n| style=\"color:red|Bar\n|}");
@@ -3784,6 +3785,10 @@
 add("selser", "Parsoid-only: Table with broken attribute value quoting on 
consecutive lines [[0,2]]", "{|\n<!--10pgp40wu8035wmi-->| title=\"Hello 
world|Foo\n| style=\"color:red|Bar\n|}");
 add("selser", "Parsoid-only: Table with broken attribute value quoting on 
consecutive lines [[2,[2,0]]]", "{|\n<!--5lodaxdvx8cnxw29-->| title=\"Hello 
world|Foo\n| style=\"color:red|Bar\n|}");
 add("selser", "Parsoid-only: Table with broken attribute value quoting on 
consecutive lines [[0,[1,0]]]", "{|\n| title=\"Hello world|Foo\n| 
style=\"color:red|Bar\n|}");
+add("selser", "Accept empty td cell attribute [[0,[[0,2],0]]]", "{|\n| 
align=\"center\" | foo ||  |\n|}");
+add("selser", "Non-empty attributes in th-cells [[0,[[2,2],3]]]", 
"{|\n\n<!--064guhbzi3jfko6r-->! Foo !! style=\"color: red\" | Bar\n|}");
+add("selser", "Accept empty attributes in th-cells [[2,[[0,2],2]]]", "{|\n!| 
foo !!| bar\n|}");
+add("selser", "Accept empty attributes in th-cells [[0,[[0,2],0]]]", "{|\n!| 
foo !!| bar\n|}");
 add("selser", "Empty table rows go away [[0,[[[2],4,2],0,0,3,1,2]]]", "{|\n| 
Hello\n| there\n|- class=\"foo\"\n|- data-foobar=\"o85ovfi85kpxecdi\"\n|}");
 add("selser", "Empty table rows go away [[3,[[[2],0,[4]],0,0,0,2,4]]]", "{|\n| 
Hello\n| there\n|- class=\"foo\"\n|-\n|}");
 add("selser", "RT-ed inter-element separators should be valid separators 
[[2],[2,[[3],4]]]", "{|\n|- [[foo]]\n|}");
diff --git a/js/tests/parserTests.txt b/js/tests/parserTests.txt
index 5674973..c7e0c65 100644
--- a/js/tests/parserTests.txt
+++ b/js/tests/parserTests.txt
@@ -16481,8 +16481,8 @@
 parsoid
 !! input
 <!--c0--><nowiki>=a=</nowiki>
-<!--c1-->
-<nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
+
+<!--c1--><nowiki>=a=</nowiki> <!--c2-->         <!--c3-->
 !! result
 <p><!--c0-->=a=</p>
 <p><!--c1-->=a= <!--c2-->       <!--c3--></p>

-- 
To view, visit https://gerrit.wikimedia.org/r/92554
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I22d64d10105087eb2fafda1c40512a3bcea777d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to