Subramanya Sastry has uploaded a new change for review.

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


Change subject: Retain accumulated separator text across node boundaries
......................................................................

Retain accumulated separator text across node boundaries

* WTS was emitting accumulated separator at node boundaries
  (after serializing children).  However, this is not necessary
  and can sometimes lose separator text when a node's children
  is only made up of separator text.

  This code might have been required at some point early in the
  WTS refactoring from a token-based strategy to a DOM-based
  strategy.  But, with a lot of bug fixes, fixing of separator
  constratins, this no longer seems to be necessary.

* This patch eliminates the regressions introduced by 2e8619ad
  (noted in the commit summary there).  Updated blacklist
  accordingly.

  This fix also eliminates the regressions found in RT testing.
  Check URL below:

http://parsoid.wmflabs.org:8001/regressions/between/33cbf927efcd2fc502524a6c2e114886cbd46eee/2e8619ad498033b1504e4e2e17fe6c503305ba18

* In addition, with this fix, 'migrateTrailingNLs' DOM pass in
  the front-end may not be necessary either unless VE code
  depends on it.  'migrateTrailingNLs' was added to eliminate
  sensitivity of serializer to where newlines showed up.
  Once again, testing shows that there is just one wt2wt regression
  (which might be because of something else).  To be investigated
  separately -- but recording it here for now.

Change-Id: I025c749f92a09fc11eeb9a574e580f5ceb486602
---
M js/lib/mediawiki.WikitextSerializer.js
M js/tests/parserTests-blacklist.js
2 files changed, 2 insertions(+), 30 deletions(-)


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

diff --git a/js/lib/mediawiki.WikitextSerializer.js 
b/js/lib/mediawiki.WikitextSerializer.js
index 651752e..2cfe772 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -443,15 +443,6 @@
                                }
                        }
 
-                       // Force out accumulated separator
-                       if (oldSep === this.sep) {
-                               if (children.length === 0) {
-                                       chunkCB('', node);
-                               } else {
-                                       chunkCB('', children.last());
-                               }
-                       }
-
                        this.chunkCB = oldCB;
 
                        if (wtEscaper) {
@@ -3807,19 +3798,12 @@
                !isValidSep(sep) ||
                (state.sep.src && state.sep.src !== sep))
        {
-               if (state.sep.constraints) {
+               if (state.sep.constraints || state.sep.src) {
                        // TODO: set modified flag if start or end node (but 
not both) are
                        // modified / new so that the selser can use the 
separator
                        sep = this.makeSeparator(state.sep.src || '',
                                                origNode,
-                                               state.sep.constraints,
-                                               state);
-               } else if (state.sep.src) {
-                       //sep = state.sep.src;
-                       // Strip whitespace from the last line
-                       sep = this.makeSeparator(state.sep.src,
-                                               origNode,
-                                               {a:{},b:{}, max:0},
+                                               state.sep.constraints || 
{a:{},b:{}, max:0},
                                                state);
                } else {
                        sep = undefined;
diff --git a/js/tests/parserTests-blacklist.js 
b/js/tests/parserTests-blacklist.js
index 1251f4b..e75571d 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -690,7 +690,6 @@
 add("wt2wt", "RT-ed inter-element separators should be valid separators");
 add("wt2wt", "Trailing newlines in a deep dom-subtree that ends a wikitext 
line should be migrated out\n(Parsoid-only since PHP parser relies on Tidy for 
correct output)");
 add("wt2wt", "Empty TD followed by TD with tpl-generated attribute");
-add("wt2wt", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext)");
 add("wt2wt", "Empty TR followed by mixed-ws-comment line should RT correctly");
 add("wt2wt", "Improperly nested inline or quotes tags with whitespace in 
between");
 
@@ -3911,17 +3910,6 @@
 add("selser", "Empty TD followed by TD with tpl-generated attribute 
[[4,[[0,0,4,0],0]]]");
 add("selser", "Empty TD followed by TD with tpl-generated attribute [[4,1]]");
 add("selser", "Indented table with an empty td [2,[3,[[0,0,0,2],4]]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[3,2]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[0,[2,0,3]]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[4,1]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[4,[[4],0,0]]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [2]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[3,[[2],0,0]]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[3,[0,0,3]]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[0,[0,0,2]]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [1]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[0,2]]");
-add("selser", "Empty TR followed by a template-generated TR\n(Parsoid-specific 
since PHP parser doesn't handle this mixed tbl-wikitext) [[0,[0,0,4]]]");
 add("selser", "Empty TR followed by mixed-ws-comment line should RT correctly 
[2]");
 add("selser", "Empty TR followed by mixed-ws-comment line should RT correctly 
[[0,[2,2,2,0]]]");
 add("selser", "Empty TR followed by mixed-ws-comment line should RT correctly 
[[0,1]]");

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I025c749f92a09fc11eeb9a574e580f5ceb486602
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