Arlolra has uploaded a new change for review.
https://gerrit.wikimedia.org/r/78195
Change subject: Removes duplicates from tokenTransformers
......................................................................
Removes duplicates from tokenTransformers
When running the tests with just --html2html, a bunch of unexpected
passes show up. Upon investigation, it seems the tokenTransformers per
key array contained duplicates (ex. 2.95 occurred twice), causing extra
newlines the output, and such.
The change assures uniqueness in the array. Maybe it would be better to
reinitialize the parserPipeline between runs?
The blacklist was written written with a bunch test fixes. Microdata
selser tests seem to generate differently but continue to fail. Not sure
why.
Bug: 52046
Change-Id: I8dd9b197be92de1cab4408a14f1dad302f4b9944
---
M js/lib/mediawiki.TokenTransformManager.js
M js/tests/parserTests-blacklist.js
2 files changed, 21 insertions(+), 61 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid
refs/changes/95/78195/1
diff --git a/js/lib/mediawiki.TokenTransformManager.js
b/js/lib/mediawiki.TokenTransformManager.js
index 5690f6f..8f04bb5 100644
--- a/js/lib/mediawiki.TokenTransformManager.js
+++ b/js/lib/mediawiki.TokenTransformManager.js
@@ -164,6 +164,7 @@
// clear cache
this.cachedTransformers = {};
} else {
+ this.removeTransform( rank, type, name );
var key = tokenTransformersKey(type, name);
var tArray = this.tokenTransformers[key];
if (!tArray) {
@@ -190,11 +191,14 @@
*/
TokenTransformManager.prototype.removeTransform = function ( rank, type, name
) {
function removeMatchingTransform(transformers, rank) {
- var i = 0, n = transformers.length;
- while (i < n && rank !== transformers[i].rank) {
- i++;
+ var i = 0;
+ while ( i < transformers.length ) {
+ if ( rank === transformers[i].rank ) {
+ transformers.splice( i, 1 );
+ } else {
+ i += 1;
+ }
}
- transformers.splice(i, 1);
}
if (type === 'any') {
diff --git a/js/tests/parserTests-blacklist.js
b/js/tests/parserTests-blacklist.js
index aca39c4..30c7884 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -541,7 +541,6 @@
add("wt2wt", "5. White-space in indent-pre\nNOTE: the white-space char on 2nd
line is significant");
add("wt2wt", "6. Pre-blocks should extend across lines with leading WS even
when there is no wrappable content");
add("wt2wt", "HTML-pre: 1. embedded newlines");
-add("wt2wt", "HTML-pre: 3: other wikitext");
add("wt2wt", "Definition lists: self-closed tag");
add("wt2wt", "External links: open square bracket forbidden in URL (named)
(bug 4377)");
add("wt2wt", "External links: Clickable images");
@@ -628,8 +627,6 @@
add("wt2wt", "Transclusion of nonexistent MediaWiki message");
add("wt2wt", "Transclusion of MediaWiki message with underscore");
add("wt2wt", "Transclusion of MediaWiki message with space");
-add("wt2wt", "Section extraction, <pre> around bogus header (bug 10309)");
-add("wt2wt", "Section replacement, <pre> around bogus header (bug 10309)");
add("wt2wt", "5 quotes, code coverage +1 line (parsoid)");
add("wt2wt", "Say the magic word");
add("wt2wt", "ISBN code coverage");
@@ -984,16 +981,10 @@
add("html2html", "CSS line continuation 2");
add("html2html", "Expansion of multi-line templates in attribute values (bug
6255 sanity check 2)");
add("html2html", "Parser hook: empty input");
-add("html2html", "Parser hook: empty input using terminated empty elements");
-add("html2html", "Parser hook: empty input using terminated empty elements
(space before)");
-add("html2html", "Parser hook: basic input");
-add("html2html", "Parser hook: case insensitive");
-add("html2html", "Parser hook: case insensitive, redux");
add("html2html", "Parser hook: nested tags");
add("html2html", "Parser hook: basic arguments");
add("html2html", "Parser hook: argument containing a forward slash (bug
5344)");
add("html2html", "Parser hook: empty input using terminated empty elements
(bug 2374)");
-add("html2html", "Parser hook: basic arguments using terminated empty elements
(bug 2374)");
add("html2html", "Parser hook: static parser hook inside a comment");
add("html2html", "Sanitizer: Closing of open tags");
add("html2html", "Sanitizer: Escaping of spaces, multibyte characters, colons
& other stuff in id=\"\"");
@@ -2442,17 +2433,6 @@
add("selser", "HTML-pre: 1. embedded newlines [0,4,0,2,0,0,1]");
add("selser", "HTML-pre: 1. embedded newlines [0,0,[2],3,0,4,4]");
add("selser", "HTML-pre: 1. embedded newlines [0,3,[4],3,0,3,[2]]");
-add("selser", "HTML-pre: 3: other wikitext [2,2]");
-add("selser", "HTML-pre: 3: other wikitext [2,0]");
-add("selser", "HTML-pre: 3: other wikitext [0,2]");
-add("selser", "HTML-pre: 3: other wikitext [[2],4]");
-add("selser", "HTML-pre: 3: other wikitext [[4],4]");
-add("selser", "HTML-pre: 3: other wikitext [[4],3]");
-add("selser", "HTML-pre: 3: other wikitext [0,4]");
-add("selser", "HTML-pre: 3: other wikitext [[4],0]");
-add("selser", "HTML-pre: 3: other wikitext [[4],2]");
-add("selser", "HTML-pre: 3: other wikitext [[3],0]");
-add("selser", "HTML-pre: 3: other wikitext [0,3]");
add("selser", "Simple definition [[[3,2],3]]");
add("selser", "Definition list with URL link [[[4,2,2],4]]");
add("selser", "Definition list with URL link [[1,0]]");
@@ -3263,21 +3243,21 @@
add("selser", "Sanitizer: Validating the contents of the id attribute (bug
4515) [1]");
add("selser", "Sanitizer: Validating the contents of the id attribute (bug
4515) [2]");
add("selser", "Sanitizer: Validating the contents of the id attribute (bug
4515) [[2]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,1,4,[0,0,0,4,0,0],0,[3],0]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[2,0,2,[0,0,0,0,0,2],0,0,4]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,1,4,[0,0,0,4,0,0],0]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[2,0,2,[0,0,0,0,0,2],0]]");
add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [2]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,1,4,[0,0,0,0,0,2],2,[2],3]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[4,1,0,[0,2,0,0,0,0],2,4,3]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[4,[3],0,0,3,4,4]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,0,4,[0,0,0,2,0,3],4,[4],0]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[4,1,0,[0,0,0,0,0,4],3,0,0]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,3,4,[0,2,0,0,0,0],4,1,4]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,[2],0,0,0,[4],4]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,0,0,2,3,[4],0]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,1,4,[0,0,0,0,0,2],2]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[4,1,0,[0,2,0,0,0,0],2]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[4,[3],0,0,3]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,0,4,[0,0,0,2,0,3],4]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[4,1,0,[0,0,0,0,0,4],3]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,3,4,[0,2,0,0,0,0],4]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,[2],0,0,0]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[0,0,0,2,3]]");
add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [1]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[2,2,0,2,0,4,0]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[2,4,0,2,3,0,0]]");
-add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[3,0,4,2,0,4,3]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[2,2,0,2,0]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[2,4,0,2,3]]");
+add("selser", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata [[3,0,4,2,0]]");
add("selser", "Fuzz testing: Parser13 [2]");
add("selser", "Fuzz testing: Parser13 [1]");
add("selser", "Fuzz testing: Parser13 [[2,2]]");
@@ -3379,30 +3359,6 @@
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, <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]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[4,3,2,0,3,2,3,3,2]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[3,0,0,0,[4],0,[3],0,2]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[[3],0,2,4,[3],2,0,0,2]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[1,3,2,0,1,3,4,4,3]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[1,0,0,3,[2],2,1,3,1]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[4,0,[3],2,4,0,0,0,[2]]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[0,0,[3],4,1,0,2,0,0]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[1,3,0,0,4,0,2,2,4]");
-add("selser", "Section extraction, <pre> around bogus header (bug 10309)
[[2],2,[3],3,0,0,2,4,0]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[1,2,0,4,0,0,[2],0,3]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[0,0,2,0,3,3,1,2,0]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[2,3,[3],0,[1],0,[4],4,[4]]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[0,0,2,3,2,4,4,3,3]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[0,3,2,4,0,0,0,2,0]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[0,2,0,0,2,4,[2],0,4]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[[3],4,[2],0,[2],0,4,2,[2]]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[0,0,2,0,0,0,4,0,2]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[0,3,0,3,3,2,4,4,4]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[[3],0,[4],0,[2],3,1,3,0]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[0,3,[3],0,4,0,0,2,4]");
-add("selser", "Section replacement, <pre> around bogus header (bug 10309)
[0,3,[4],0,0,0,[4],2,4]");
add("selser", "Handling of 
 in URLs [[[2]]]");
add("selser", "Handling of 
 in URLs [[[[2]]]]");
add("selser", "Handling of 
 in URLs [[[1]]]");
--
To view, visit https://gerrit.wikimedia.org/r/78195
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8dd9b197be92de1cab4408a14f1dad302f4b9944
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits