GWicke has uploaded a new change for review.

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


Change subject: More precise check for possible changes in text nodes
......................................................................

More precise check for possible changes in text nodes

* In rt mode (editMode === false), we can extrapolate dsr

* We don't diff when selser is disabled, so don't assume nothing has changed
  then.

* New blacklist entries. TODO: Figure out why.

Change-Id: Idd17d6b40cde8ec870878a91105aa9711f223610
---
M js/lib/mediawiki.WikitextSerializer.js
M js/tests/parserTests-blacklist.js
2 files changed, 20 insertions(+), 1 deletion(-)


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

diff --git a/js/lib/mediawiki.WikitextSerializer.js 
b/js/lib/mediawiki.WikitextSerializer.js
index ed37b3a..6cb8fc0 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -3467,7 +3467,11 @@
                                        prevNode.previousSibling.nodeType === 
prevNode.ELEMENT_NODE &&
                                        
prevNode.previousSibling.data.parsoid.dsr &&
                                        // Don't extrapolate if the string was 
potentially changed
-                                       
!DU.directChildrenChanged(node.parentNode, this.env))
+                                       // or we didn't diff (selser disabled)
+                                       (!this.env.conf.parsoid.editMode || // 
no changes in rt testing
+                                        // diffed and no change here
+                                        (state.selserMode &&
+                                               
!DU.directChildrenChanged(node.parentNode, this.env))))
                        {
                                var endDsr = 
prevNode.previousSibling.data.parsoid.dsr[1],
                                        correction;
diff --git a/js/tests/parserTests-blacklist.js 
b/js/tests/parserTests-blacklist.js
index 241f83f..7c35a9c 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -543,6 +543,7 @@
 add("wt2wt", "Italicized possessive");
 add("wt2wt", "Parsoid only: Quote balancing context should be restricted to 
td/th cells on the same wikitext line\n(Requires tidy for PHP parser output to 
be fixed up)");
 add("wt2wt", "Comment semantics: unclosed comment at end");
+add("wt2wt", "Multiple lines without block tags");
 add("wt2wt", "<nowiki> inside <pre> (bug 13238)");
 add("wt2wt", "<nowiki> and <pre> preference (first one wins)");
 add("wt2wt", "Templates: Single-line variant of parameter whitespace stripping 
test");
@@ -2306,6 +2307,15 @@
 add("selser", "Comment semantics: unclosed comment at end [3]");
 add("selser", "Comment semantics: unclosed comment at end [4]");
 add("selser", "Comment semantics: unclosed comment at end [2]");
+add("selser", "Multiple lines without block tags [2,4,0,0,0,[4],0]");
+add("selser", "Multiple lines without block tags [2,0,[2,2,3],4,0,[2],3]");
+add("selser", "Multiple lines without block tags [0,3,[3,3,2],2,0,3,4]");
+add("selser", "Multiple lines without block tags [[2],4,[0,4,2],0,0,3,0]");
+add("selser", "Multiple lines without block tags [0,4,1,0,3,0,4]");
+add("selser", "Multiple lines without block tags [2,0,[4,3,0],0,3,0,0]");
+add("selser", "Multiple lines without block tags [[3],3,1,4,0,0,2]");
+add("selser", "Multiple lines without block tags [2,0,[2,0,0],0,4,3,4]");
+add("selser", "Empty lines between lines with block tags 
[1,0,2,3,3,0,[2],0,0,0,0,4,3,2,[2]]");
 add("selser", "<nowiki> inside <pre> (bug 13238) [4,2,2,0,0]");
 add("selser", "<nowiki> inside <pre> (bug 13238) [0,0,4,0,[[4],0,2,4]]");
 add("selser", "<nowiki> inside <pre> (bug 13238) [3,0,3,3,2]");
@@ -3287,6 +3297,11 @@
 add("selser", "Transclusion of MediaWiki message with space [[3]]");
 add("selser", "Transclusion of MediaWiki message with space [[4]]");
 add("selser", "Transclusion of MediaWiki message with space [[2]]");
+add("selser", "Section extraction, heading surrounded by <noinclude> 
[0,2,3,0,0]");
+add("selser", "Section extraction, heading surrounded by <noinclude> 
[1,2,4,4,0]");
+add("selser", "Section extraction, heading surrounded by <noinclude> 
[0,2,4,0,3]");
+add("selser", "Section extraction, heading surrounded by <noinclude> 
[0,2,2,0,0]");
+add("selser", "Section extraction, heading surrounded by <noinclude> 
[1,2,0,0,0]");
 add("selser", "Section extraction, <pre> around bogus header (bug 10309) 
[0,0,0,4,[3],0,[4],3,0]");
 add("selser", "Section extraction, <pre> around bogus header (bug 10309) 
[2,0,[2],0,[1],0,0,2,2]");
 add("selser", "Section extraction, <pre> around bogus header (bug 10309) 
[2,3,[4],2,1,4,4,0,1]");

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

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

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

Reply via email to