C. Scott Ananian has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/340329 )

Change subject: Add an option to force strong normalization of parser tests.
......................................................................

Add an option to force strong normalization of parser tests.

This allows us to remove html2wt and html2html entries from the blacklist,
even when the test doesn't merit adding specific html/parsoid clauses.

Change-Id: I03a8dc7ffcc180a05128c4c63807cee281abb1e9
---
M bin/parserTests.js
M tests/parserTests-blacklist.js
M tests/parserTests.txt
3 files changed, 50 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/29/340329/1

diff --git a/bin/parserTests.js b/bin/parserTests.js
index 985cd6e..9fb79db 100755
--- a/bin/parserTests.js
+++ b/bin/parserTests.js
@@ -718,7 +718,9 @@
        var endsAtWikitext = mode === 'wt2wt' || mode === 'selser' || mode === 
'html2wt';
        var endsAtHtml = mode === 'wt2html' || mode === 'html2html';
 
-       var parsoidOnly = ('html/parsoid' in item) || (item.options.parsoid !== 
undefined);
+       var parsoidOnly =
+               ('html/parsoid' in item) ||
+               (item.options.parsoid !== undefined && 
!item.options.parsoid.normalizePhp);
 
        // Source preparation
        if (startsAtHtml) {
@@ -892,7 +894,8 @@
 ParserTests.prototype.checkHTML = function(item, out, options, mode) {
        var normalizedOut, normalizedExpected;
        var parsoidOnly =
-               ('html/parsoid' in item) || (item.options.parsoid !== 
undefined);
+               ('html/parsoid' in item) ||
+               (item.options.parsoid !== undefined && 
!item.options.parsoid.normalizePhp);
 
        normalizedOut = DU.normalizeOut(out, parsoidOnly);
        out = DU.toXML(out, { innerXML: true });
diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index dc5b9cb..b85a9f1 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -787,43 +787,6 @@
 add("html2wt", "Magic Word: {{CURRENTYEAR}}", "1970\n");
 add("html2wt", "Magic Word: {{CURRENTTIMESTAMP}}", "19700101000203\n");
 add("html2wt", "Magic Words LOCAL (UTC)", "* 01\n* 1\n* January\n* January\n* 
Jan\n* 1\n* 01\n* Thursday\n* 1970\n* 00:02\n* 00\n* 1\n* 4\n* 
19700101000203\n");
-add("html2wt", "Magic Word: {{FULLPAGENAME}}", "User:Ævar Arnfjörð 
Bjarmason\n");
-add("html2wt", "Magic Word: {{FULLPAGENAMEE}}", 
"User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason\n");
-add("html2wt", "Magic Word: {{TALKSPACE}}", "User talk\n");
-add("html2wt", "Magic Word: {{TALKSPACE}}, same namespace", "User talk\n");
-add("html2wt", "Magic Word: {{TALKSPACE}}, main namespace", "Talk\n");
-add("html2wt", "Magic Word: {{TALKSPACEE}}", "User_talk\n");
-add("html2wt", "Magic Word: {{SUBJECTSPACE}}", "User\n");
-add("html2wt", "Magic Word: {{SUBJECTSPACE}}, same namespace", "User\n");
-add("html2wt", "Magic Word: {{SUBJECTSPACE}}, main namespace", "");
-add("html2wt", "Magic Word: {{SUBJECTSPACEE}}", "User\n");
-add("html2wt", "Magic Word: {{NAMESPACE}}", "User\n");
-add("html2wt", "Magic Word: {{NAMESPACEE}}", "User\n");
-add("html2wt", "Magic Word: {{NAMESPACENUMBER}}", "2\n");
-add("html2wt", "Magic Word: {{SUBPAGENAME}}", "sub ö\n");
-add("html2wt", "Magic Word: {{SUBPAGENAMEE}}", "sub_%C3%B6\n");
-add("html2wt", "Magic Word: {{ROOTPAGENAME}}", "Ævar Arnfjörð Bjarmason\n");
-add("html2wt", "Magic Word: {{ROOTPAGENAMEE}}", 
"%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason\n");
-add("html2wt", "Magic Word: {{BASEPAGENAME}}", "Ævar Arnfjörð Bjarmason\n");
-add("html2wt", "Magic Word: {{BASEPAGENAMEE}}", 
"%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason\n");
-add("html2wt", "Magic Word: {{TALKPAGENAME}}", "User talk:Ævar Arnfjörð 
Bjarmason\n");
-add("html2wt", "Magic Word: {{TALKPAGENAMEE}}", 
"User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason\n");
-add("html2wt", "Magic Word: {{SUBJECTPAGENAME}}", "User:Ævar Arnfjörð 
Bjarmason\n");
-add("html2wt", "Magic Word: {{SUBJECTPAGENAMEE}}", 
"User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason\n");
-add("html2wt", "Magic Word: {{NUMBEROFFILES}}", "7\n");
-add("html2wt", "Magic Word: {{PAGENAME}}", "Ævar Arnfjörð Bjarmason\n");
-add("html2wt", "Magic Word: {{PAGENAME}} with metacharacters", 
"''<nowiki/>'foo & bar = baz'''\n");
-add("html2wt", "Magic Word: {{PAGENAME}} with metacharacters (T28781)", 
"<nowiki>*</nowiki><nowiki>RFC 1234</nowiki> 
<nowiki>http://example.com/</nowiki>\n");
-add("html2wt", "Magic Word: {{PAGENAMEE}}", 
"%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason\n");
-add("html2wt", "Magic Word: {{PAGENAMEE}} with metacharacters (T28781)", 
"<nowiki>*</nowiki>RFC_1234_http://example.com/\n";);
-add("html2wt", "Magic Word: {{REVISIONID}}", "1337\n");
-add("html2wt", "Magic Word: {{SCRIPTPATH}}", "");
-add("html2wt", "Magic Word: {{STYLEPATH}}", "/skins\n");
-add("html2wt", "Magic Word: {{SERVER}}", "http://example.org\n";);
-add("html2wt", "Magic Word: {{SERVERNAME}}", "example.org\n");
-add("html2wt", "Magic Word: {{SITENAME}}", "MediaWiki\n");
-add("html2wt", "Magic Word: {{PAGELANGUAGE}}", "fr\n");
-add("html2wt", "Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set 
language", "en\n");
 add("html2wt", "Case-sensitive magic words, when cased differently, should 
just be template transclusions", 
"[/index.php?title=Template:CurrentMonth&action=edit&redlink=1 
Template:CurrentMonth]\n[/index.php?title=Template:Currentday&action=edit&redlink=1
 
Template:Currentday]\n[/index.php?title=Template:CURreNTweEK&action=edit&redlink=1
 
Template:CURreNTweEK]\n[/index.php?title=Template:CurrentHour&action=edit&redlink=1
 Template:CurrentHour]\n");
 add("html2wt", "Case-insensitive magic words should still work with weird 
casing.", "example.org\naOEU\nAoeu\nhttp://example.org\n";);
 add("html2wt", "Namespace 1 {{ns:1}}", "Talk\n");
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index ba9ab75..74438dc 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -9962,6 +9962,7 @@
 Magic Word: {{FULLPAGENAME}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{FULLPAGENAME}}
 !! html
@@ -9973,6 +9974,7 @@
 Magic Word: {{FULLPAGENAMEE}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{FULLPAGENAMEE}}
 !! html
@@ -9984,6 +9986,7 @@
 Magic Word: {{TALKSPACE}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{TALKSPACE}}
 !! html
@@ -9995,6 +9998,7 @@
 Magic Word: {{TALKSPACE}}, same namespace
 !! options
 title=[[User talk:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{TALKSPACE}}
 !! html
@@ -10006,6 +10010,7 @@
 Magic Word: {{TALKSPACE}}, main namespace
 !! options
 title=[[Parser Test]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{TALKSPACE}}
 !! html
@@ -10017,6 +10022,7 @@
 Magic Word: {{TALKSPACEE}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{TALKSPACEE}}
 !! html
@@ -10028,6 +10034,7 @@
 Magic Word: {{SUBJECTSPACE}}
 !! options
 title=[[User talk:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SUBJECTSPACE}}
 !! html
@@ -10039,6 +10046,7 @@
 Magic Word: {{SUBJECTSPACE}}, same namespace
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SUBJECTSPACE}}
 !! html
@@ -10050,6 +10058,7 @@
 Magic Word: {{SUBJECTSPACE}}, main namespace
 !! options
 title=[[Parser Test]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SUBJECTSPACE}}
 !! html
@@ -10060,6 +10069,7 @@
 Magic Word: {{SUBJECTSPACEE}}
 !! options
 title=[[User talk:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SUBJECTSPACEE}}
 !! html
@@ -10071,6 +10081,7 @@
 Magic Word: {{NAMESPACE}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{NAMESPACE}}
 !! html
@@ -10082,6 +10093,7 @@
 Magic Word: {{NAMESPACEE}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{NAMESPACEE}}
 !! html
@@ -10093,6 +10105,7 @@
 Magic Word: {{NAMESPACENUMBER}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{NAMESPACENUMBER}}
 !! html
@@ -10104,6 +10117,7 @@
 Magic Word: {{SUBPAGENAME}}
 !! options
 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SUBPAGENAME}}
 !! html
@@ -10115,6 +10129,7 @@
 Magic Word: {{SUBPAGENAMEE}}
 !! options
 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SUBPAGENAMEE}}
 !! html
@@ -10126,6 +10141,7 @@
 Magic Word: {{ROOTPAGENAME}}
 !! options
 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{ROOTPAGENAME}}
 !! html
@@ -10137,6 +10153,7 @@
 Magic Word: {{ROOTPAGENAMEE}}
 !! options
 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{ROOTPAGENAMEE}}
 !! html
@@ -10148,6 +10165,7 @@
 Magic Word: {{BASEPAGENAME}}
 !! options
 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{BASEPAGENAME}}
 !! html
@@ -10159,6 +10177,7 @@
 Magic Word: {{BASEPAGENAMEE}}
 !! options
 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{BASEPAGENAMEE}}
 !! html
@@ -10170,6 +10189,7 @@
 Magic Word: {{TALKPAGENAME}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{TALKPAGENAME}}
 !! html
@@ -10181,6 +10201,7 @@
 Magic Word: {{TALKPAGENAMEE}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{TALKPAGENAMEE}}
 !! html
@@ -10192,6 +10213,7 @@
 Magic Word: {{SUBJECTPAGENAME}}
 !! options
 title=[[User talk:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SUBJECTPAGENAME}}
 !! html
@@ -10203,6 +10225,7 @@
 Magic Word: {{SUBJECTPAGENAMEE}}
 !! options
 title=[[User talk:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SUBJECTPAGENAMEE}}
 !! html
@@ -10212,6 +10235,8 @@
 
 !! test
 Magic Word: {{NUMBEROFFILES}}
+!! options
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{NUMBEROFFILES}}
 !! html
@@ -10223,6 +10248,7 @@
 Magic Word: {{PAGENAME}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{PAGENAME}}
 !! html
@@ -10234,6 +10260,7 @@
 Magic Word: {{PAGENAME}} with metacharacters
 !! options
 title=[['foo & bar = baz']]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 ''{{PAGENAME}}''
 !! html/php
@@ -10247,6 +10274,7 @@
 Magic Word: {{PAGENAME}} with metacharacters (T28781)
 !! options
 title=[[*RFC 1234 http://example.com/]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{PAGENAME}}
 !! html/php
@@ -10260,6 +10288,7 @@
 Magic Word: {{PAGENAMEE}}
 !! options
 title=[[User:Ævar Arnfjörð Bjarmason]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{PAGENAMEE}}
 !! html
@@ -10271,6 +10300,7 @@
 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
 !! options
 title=[[*RFC 1234 http://example.com/]]
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{PAGENAMEE}}
 !! html/php
@@ -10282,6 +10312,8 @@
 
 !! test
 Magic Word: {{REVISIONID}}
+!! options
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{REVISIONID}}
 !! html
@@ -10291,6 +10323,8 @@
 
 !! test
 Magic Word: {{SCRIPTPATH}}
+!! options
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SCRIPTPATH}}
 !! html
@@ -10299,6 +10333,8 @@
 
 !! test
 Magic Word: {{STYLEPATH}}
+!! options
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{STYLEPATH}}
 !! html
@@ -10308,6 +10344,8 @@
 
 !! test
 Magic Word: {{SERVER}}
+!! options
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SERVER}}
 !! html
@@ -10317,6 +10355,8 @@
 
 !! test
 Magic Word: {{SERVERNAME}}
+!! options
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SERVERNAME}}
 !! html
@@ -10326,6 +10366,8 @@
 
 !! test
 Magic Word: {{SITENAME}}
+!! options
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{SITENAME}}
 !! html
@@ -10337,6 +10379,7 @@
 Magic Word: {{PAGELANGUAGE}}
 !! options
 language=fr
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{PAGELANGUAGE}}
 !! html
@@ -10346,6 +10389,8 @@
 
 !! test
 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
+!! options
+parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
 !! wikitext
 {{PAGELANGUAGE}}
 !! html

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03a8dc7ffcc180a05128c4c63807cee281abb1e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to