Arlolra has uploaded a new change for review.
https://gerrit.wikimedia.org/r/272834
Change subject: Sync parserTests with core
......................................................................
Sync parserTests with core
* The new failing test is from a regression introduced in cf9fb74f.
That patch pays lip service to the core patch and then goes ahead and
breaks it.
Change-Id: Ic23f7f144f22e361d3edf2cded28fed4cd17320b
---
M tests/parserTests-blacklist.js
M tests/parserTests.txt
M tools/fetch-parserTests.txt.js
3 files changed, 70 insertions(+), 100 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/34/272834/1
diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index b7372a8..28abfe0 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -56,6 +56,7 @@
add("wt2html", "Definition Lists: colons and tables 1", "<dl
data-parsoid='{\"dsr\":[0,21,0,0]}'><dd
data-parsoid='{\"dsr\":[0,10,1,0]}'><table
data-parsoid='{\"dsr\":[1,10,2,2]}'>\n<tbody
data-parsoid='{\"dsr\":[4,8,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[4,7,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[4,7,1,0]}'>
x</td></tr>\n</tbody></table></dd>\n<dd
data-parsoid='{\"dsr\":[11,21,1,0]}'><table
data-parsoid='{\"dsr\":[12,21,2,2]}'>\n<tbody
data-parsoid='{\"dsr\":[15,19,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[15,18,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[15,18,1,0]}'>
y</td></tr>\n</tbody></table></dd></dl>");
add("wt2html", "Bug 2702: Mismatched <i>, <b> and <a> tags are invalid", "<p
data-parsoid='{\"dsr\":[0,204,0,0]}'><i
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[0,29,2,0]}'><a
rel=\"mw:ExtLink\" href=\"http://example.com\"
data-parsoid='{\"targetOff\":22,\"contentOffsets\":[22,28],\"dsr\":[2,29,20,1]}'>text<i
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[26,28,2,0]}'></i></a></i>\n<a
rel=\"mw:ExtLink\" href=\"http://example.com\"
data-parsoid='{\"targetOff\":50,\"contentOffsets\":[50,57],\"dsr\":[30,58,20,1]}'><b
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[50,57,3,0]}'>text</b></a><b
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[58,61,3,0]}'></b>\n<i
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[62,106,2,0]}'>Something <a
rel=\"mw:ExtLink\" href=\"http://example.com\"
data-parsoid='{\"targetOff\":94,\"contentOffsets\":[94,105],\"dsr\":[74,106,20,1]}'>in
italic<i
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[103,105,2,0]}'></i></a></i>\n<i
data-parsoid='{\"dsr\":[107,164,2,2]}'>Something <a rel=\"mw:ExtLink\"
href=\"http://example.com\"
data-parsoid='{\"targetOff\":139,\"contentOffsets\":[139,160],\"dsr\":[119,161,20,1]}'>mixed<b
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[144,160,3,0]}'><i
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[147,160,2,0]}'>, even
bold</i></b></a>'</i>\n<b
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[165,204,3,0]}'><i
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[168,204,2,0]}'>Now <a
rel=\"mw:ExtLink\" href=\"http://example.com\"
data-parsoid='{\"targetOff\":194,\"contentOffsets\":[194,203],\"dsr\":[174,204,20,1]}'>both<b
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[198,203,3,0]}'><i
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[201,203,2,0]}'></i></b></a></i></b></p>");
add("wt2html", "External link containing double-single-quotes in text embedded
in italics (bug 4598 sanity check)", "<p data-parsoid='{\"dsr\":[0,60,0,0]}'><i
data-parsoid='{\"dsr\":[0,60,2,2]}'>Some <a rel=\"mw:ExtLink\"
href=\"http://example.com/\"
data-parsoid='{\"targetOff\":28,\"contentOffsets\":[28,56],\"dsr\":[7,57,21,1]}'>pretty
<i data-parsoid='{\"dsr\":[35,46,2,2]}'>italics</i> and stuff</a>!</i></p>");
+add("wt2html", "! and || in element attributes should not be parsed as
<th>/<td>", "<table data-parsoid='{\"dsr\":[0,86,2,2]}'>\n<tbody
data-parsoid='{\"dsr\":[3,84,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[3,83,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[3,71,1,0]}'> <div
style=\"color: red !important;\" data-contrived=\"put this here </td><td
data-parsoid='{\"stx_v\":\"row\",\"autoInsertedEnd\":true,\"dsr\":[71,83,2,0]}'>\">hi</td></tr>\n</tbody></table>");
add("wt2html", "Self-link to numeric title", "<p
data-parsoid='{\"dsr\":[0,5,0,0]}'><a rel=\"mw:WikiLink\" href=\"./0\"
title=\"0\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./0\"},\"sa\":{\"href\":\"0\"},\"dsr\":[0,5,2,2]}'>0</a></p>");
add("wt2html", "<nowiki> inside a link", "<p
data-parsoid='{\"dsr\":[0,96,0,0]}'><a rel=\"mw:WikiLink\" href=\"./Main_Page\"
title=\"Main Page\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main<nowiki>
Page</nowiki>\"},\"dsr\":[0,30,2,2]}'>Main Page</a> <a rel=\"mw:WikiLink\"
href=\"./Main_Page\" title=\"Main Page\"
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main
Page\"},\"dsr\":[31,96,12,2]}'>the main page <span typeof=\"mw:Nowiki\"
data-parsoid='{\"dsr\":[57,94,8,9]}'>[it's not very good]</span></a></p>");
add("wt2html", "Interlanguage link with spacing", "<p
data-parsoid='{\"dsr\":[0,14,0,0]}'>Blah blah blah</p>\n<link
rel=\"mw:PageProp/Language\" href=\"http://zh.wikipedia.org/wiki/ Chinese
\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"http://zh.wikipedia.org/wiki/
Chinese \"},\"sa\":{\"href\":\" zh : Chinese
\"},\"dsr\":[15,43,null,null]}'/>");
@@ -92,6 +93,7 @@
add("wt2html", "Magic Word: {{PAGENAMEE}}", "<span about=\"#mwt1\"
typeof=\"mw:Transclusion\"
data-parsoid='{\"dsr\":[0,13,null,null],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAMEE\",\"function\":\"pagenamee\"},\"params\":{},\"i\":0}}]}'></span>");
add("wt2html", "Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)",
"<span about=\"#mwt1\" typeof=\"mw:Transclusion\"
data-parsoid='{\"dsr\":[0,13,null,null],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAMEE\",\"function\":\"pagenamee\"},\"params\":{},\"i\":0}}]}'></span>");
add("wt2html", "Magic Word: {{REVISIONID}}", "<p
data-parsoid='{\"dsr\":[0,14,0,0]}'><span typeof=\"mw:Transclusion
mw:Placeholder\" about=\"#mwt1\" id=\"mwt1\"
data-parsoid='{\"dsr\":[0,14,null,null],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"REVISIONID\",\"href\":\"./Template:REVISIONID\"},\"params\":{},\"i\":0}}]}'>Warning:
Page/template fetching disabled, and no cache for
Template:REVISIONID</span></p>");
+add("wt2html", "Magic Word: {{SCRIPTPATH}}", "<p about=\"#mwt1\"
typeof=\"mw:Transclusion\" data-parsoid='{\"dsr\":[0,14,0,0],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"SCRIPTPATH\",\"function\":\"scriptpath\"},\"params\":{},\"i\":0}}]}'>/</p>");
add("wt2html", "Magic Word: {{STYLEPATH}}", "<p
data-parsoid='{\"dsr\":[0,13,0,0]}'><span typeof=\"mw:Transclusion
mw:Placeholder\" about=\"#mwt1\" id=\"mwt1\"
data-parsoid='{\"dsr\":[0,13,null,null],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"STYLEPATH\",\"href\":\"./Template:STYLEPATH\"},\"params\":{},\"i\":0}}]}'>Warning:
Page/template fetching disabled, and no cache for
Template:STYLEPATH</span></p>");
add("wt2html", "Case-sensitive magic words, when cased differently, should
just be template transclusions", "<p data-parsoid='{\"dsr\":[0,63,0,0]}'><span
typeof=\"mw:Transclusion mw:Placeholder\" about=\"#mwt1\" id=\"mwt1\"
data-parsoid='{\"dsr\":[0,16,null,null],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"CurrentMonth\",\"href\":\"./Template:CurrentMonth\"},\"params\":{},\"i\":0}}]}'>Warning:
Page/template fetching disabled, and no cache for
Template:CurrentMonth</span>\n<span typeof=\"mw:Transclusion mw:Placeholder\"
about=\"#mwt2\" id=\"mwt2\"
data-parsoid='{\"dsr\":[17,31,null,null],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"currentday\",\"href\":\"./Template:Currentday\"},\"params\":{},\"i\":0}}]}'>Warning:
Page/template fetching disabled, and no cache for
Template:Currentday</span>\n<span typeof=\"mw:Transclusion mw:Placeholder\"
about=\"#mwt3\" id=\"mwt3\"
data-parsoid='{\"dsr\":[32,47,null,null],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"cURreNTweEK\",\"href\":\"./Template:CURreNTweEK\"},\"params\":{},\"i\":0}}]}'>Warning:
Page/template fetching disabled, and no cache for
Template:CURreNTweEK</span>\n<span typeof=\"mw:Transclusion mw:Placeholder\"
about=\"#mwt4\" id=\"mwt4\"
data-parsoid='{\"dsr\":[48,63,null,null],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"currentHour\",\"href\":\"./Template:CurrentHour\"},\"params\":{},\"i\":0}}]}'>Warning:
Page/template fetching disabled, and no cache for
Template:CurrentHour</span></p>");
add("wt2html", "Namespace 1 {{ns:1}}", "<p about=\"#mwt1\"
typeof=\"mw:Transclusion\" data-parsoid='{\"dsr\":[0,8,0,0],\"pi\":[[]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"ns:1\",\"function\":\"ns\"},\"params\":{},\"i\":0}}]}'>1</p>");
@@ -155,7 +157,6 @@
add("wt2html", "Media link with nasty text", "<p
data-parsoid='{\"dsr\":[0,106,0,0]}'><a rel=\"mw:WikiLink\"
href=\"./Media:Foobar.jpg\" title=\"Media:Foobar.jpg\"
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Media:Foobar.jpg\"},\"sa\":{\"href\":\"Media:Foobar.jpg\"},\"dsr\":[0,106,19,2]}'>Safe
Link<div style=\"display:none\"
data-parsoid='{\"stx\":\"html\",\"dsr\":[28,104,24,6]}'>\"
onmouseover=\"alert(document.cookie)\" onfoo=\"</div></a></p>");
add("wt2html", "Media link to nonexistent file (bug 1702)", "<p
data-parsoid='{\"dsr\":[0,21,0,0]}'><a rel=\"mw:WikiLink\"
href=\"./Media:No_such.jpg\" title=\"Media:No such.jpg\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Media:No_such.jpg\"},\"sa\":{\"href\":\"Media:No
such.jpg\"},\"dsr\":[0,21,2,2]}'>Media:No such.jpg</a></p>");
add("wt2html", "(bug 19451) Links should refer to the normalized form.", "<p
data-parsoid='{\"dsr\":[0,64,0,0]}'><a rel=\"mw:WikiLink\" href=\"./אַ\"
title=\"אַ\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./אַ\"},\"sa\":{\"href\":\"&#xFB2E;\"},\"dsr\":[0,12,2,2]}'>אַ</a>\n<a
rel=\"mw:WikiLink\" href=\"./אַ\" title=\"אַ\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./אַ\"},\"sa\":{\"href\":\"&#x5d0;&#x5b7;\"},\"dsr\":[13,31,2,2]}'>אַ</a>\n<a
rel=\"mw:WikiLink\" href=\"./אַ\" title=\"אַ\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./אַ\"},\"sa\":{\"href\":\"&#x5d0;ַ\"},\"dsr\":[32,44,2,2]}'>אַ</a>\n<a
rel=\"mw:WikiLink\" href=\"./אַ\" title=\"אַ\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./אַ\"},\"sa\":{\"href\":\"א&#x5b7;\"},\"dsr\":[45,57,2,2]}'>אַ</a>\n<a
rel=\"mw:WikiLink\" href=\"./אַ\" title=\"אַ\"
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./אַ\"},\"sa\":{\"href\":\"אַ\"},\"dsr\":[58,64,2,2]}'>אַ</a></p>");
-add("wt2html", "Attribute test: equals, then nothing", "<p
data-parsoid='{\"dsr\":[0,23,0,0]}'><font color=\"\"
data-parsoid='{\"stx\":\"html\",\"dsr\":[0,23,13,7]}'>foo</font></p>");
add("wt2html", "Bug 2304: HTML attribute safety (unsafe breakout parameter;
2309)", "<div style=\"float: right; >alert(document.cookie)\" about=\"#mwt1\"
typeof=\"mw:Transclusion\"
data-parsoid='{\"stx\":\"html\",\"a\":{\"style\":\"float: right;
>alert(document.cookie)\"},\"sa\":{\"style\":\"float: right;
{{{1}}}\"},\"dsr\":[0,55,null,null],\"pi\":[[{\"k\":\"1\"}]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"div
style\",\"href\":\"./Template:Div_style\"},\"params\":{\"1\":{\"wt\":\"\\\"><script>alert(document.cookie)</script>\"}},\"i\":0}}]}'>Magic
div</div>");
add("wt2html", "Bug 2304: HTML attribute safety (unsafe breakout parameter 2;
2309)", "<div style=\"float: right; >alert(document.cookie)\" about=\"#mwt1\"
typeof=\"mw:Transclusion\"
data-parsoid='{\"stx\":\"html\",\"a\":{\"style\":\"float: right;
>alert(document.cookie)\"},\"sa\":{\"style\":\"float: right;
{{{1}}}\"},\"dsr\":[0,56,null,null],\"pi\":[[{\"k\":\"1\"}]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"div
style\",\"href\":\"./Template:Div_style\"},\"params\":{\"1\":{\"wt\":\"\\\"
><script>alert(document.cookie)</script>\"}},\"i\":0}}]}'>Magic
div</div>");
add("wt2html", "CSS safety test (all browsers): vertical tab (bug 55332 /
CVE-2013-4567)", "<p style=\"/* insecure input */\"
data-parsoid='{\"stx\":\"html\",\"a\":{\"style\":\"/* insecure input
*/\"},\"sa\":{\"style\":\"font-size: 100px;
background-image:url\\\\b(https://www.google.com/images/srpr/logo6w.png)\"},\"dsr\":[0,104,99,4]}'>A</p>");
@@ -311,6 +312,7 @@
add("wt2wt", "Table rowspan", "{| 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("wt2wt", "Nested table", "{| border=\"1\"\n| α\n|\n{|
bgcolor=\"#ABCDEF\" border=\"2\"\n|nested\n|-\n|table\n|}\n|the original table
again\n|}");
add("wt2wt", "Invalid attributes in table cell (bug 1830)", "{|\n| Cell:
|broken\n|}");
+add("wt2wt", "! and || in element attributes should not be parsed as
<th>/<td>", "{|\n| <div style=\"color: red !important;\" data-contrived=\"put
this here ||\">hi\n|}");
add("wt2wt", "Table attributes with empty value", "{|\n| style=\"\" |
hello\n|}");
add("wt2wt", "Build table with {{!}}", "{{{!}} class=\"wikitable\"\n!
header\n! second header\n{{!}}- style=\"color:red;\"\n{{!}} data {{!}}{{!}}
style=\"color:red;\"{{!}} second data\n{{!}}}");
add("wt2wt", "Build table with pipe as data", "{| class=\"wikitable\"\n!
header\n! second header\n|- style=\"color:red;\"\n| data ||
style=\"color:red;\" | second data\n|-\n| style=\"color:red;\" |<nowiki> data
with | </nowiki>|| style=\"color:red;\" | second data with |\n|-\n||<nowiki>
data with | </nowiki>||| second data with |\n|}");
@@ -343,14 +345,11 @@
add("wt2wt", "div with unquoted attribute", "<div id=\"rock\">HTML
rocks</div>");
add("wt2wt", "div with illegal double attributes", "<div id=\"b\">HTML
rocks</div>");
add("wt2wt", "div with empty attribute value, space before equals", "<div
class=\"\">HTML rocks</div>");
-add("wt2wt", "div with multiple empty attribute values", "<div id=\"\"
title=\"\">HTML rocks</div>");
-add("wt2wt", "table with multiple empty attribute values", "{| title=\"\"
id=\"\"\n| hi\n|}");
add("wt2wt", "HTML multiple attributes correction", "<p
class=\"awesome\">Awesome!</p>");
add("wt2wt", "Table multiple attributes correction", "{|\n! class=\"awesome\"
+ | status\n|}");
add("wt2wt", "DIV IN UPPERCASE", "<DIV id=\"x\">HTML ROCKS</DIV>");
add("wt2wt", "Media link with nasty text", "[[Media:Foobar.jpg|Safe Link]]<div
style=\"display:none\">[[Media:Foobar.jpg|\"
onmouseover=\"alert(document.cookie)\" onfoo=\"]]</div>\n");
add("wt2wt", "Empty attribute crash test single-quotes (bug 2067)", "<font
color=\"\">foo</font>\n");
-add("wt2wt", "Attribute test: equals, then nothing", "<font
color=\"\">foo</font>\n");
add("wt2wt", "Attribute test: unquoted value", "<font
color=\"x\">foo</font>\n");
add("wt2wt", "Attribute test: unquoted but illegal value (hash)", "<font
color=\"#x\">foo</font>\n");
add("wt2wt", "Bug 2095: link with pipe and three closing brackets, version 2",
"[[Main Page|<nowiki>[http://example.com/]</nowiki>]]\n");
@@ -388,9 +387,6 @@
add("wt2wt", "Ref: 19. ref-tags with identical name encodings should get
identical indexes", "1 <ref name=\"a & b\">foo</ref> 2 <ref name=\"a &amp;
b\" />\n\n<references />");
add("wt2wt", "References: 9. Generate missing references list at the end", "A
<ref>foo</ref>\nB <ref group=\"inexistent\">bar</ref>\n<references
/>\n<references group=\"inexistent\" />");
add("wt2wt", "Entities in ref name", "<ref name=\"test &amp;
me\">hi</ref>\n<references />");
-add("wt2wt", "HTML tag with broken attribute value quoting", "<span
title=\"Hello world\">Foo</span>\n");
-add("wt2wt", "Table with broken attribute value quoting", "{|\n| title=\"Hello
world\" |Foo\n|}");
-add("wt2wt", "Table with broken attribute value quoting on consecutive lines",
"{|\n| title=\"Hello world\" |Foo\n| style=\"color:red\" |Bar\n|}");
add("wt2wt", "Trailing newlines in a deep dom-subtree that ends a wikitext
line should be migrated out",
"{|\n|<small>foo\n\nbar\n|}\n\n{|\n|<small>foo<small>\n|}");
add("wt2wt", "Empty TD followed by TD with tpl-generated attribute",
"{|\n|-\n|\n| {{echo|style='color:red'}} |foo\n|}");
add("wt2wt", "Improperly nested inline or quotes tags with whitespace in
between", "<span> <s>x</span> </s>\n''' ''x'''''<nowiki/>'' ''\n");
@@ -422,6 +418,7 @@
add("html2html", "Definition list with wikilink containing colon", "<dl
data-parsoid='{\"dsr\":[0,95,0,0]}'><dt data-parsoid='{\"dsr\":[0,24,1,0]}'>
[/index.php?title=Help</dt><dd
data-parsoid='{\"stx\":\"row\",\"dsr\":[24,60,1,0]}'>FAQ&action=edit&redlink=1
Help:FAQ]</dd>\n<dd data-parsoid='{\"dsr\":[61,95,1,0]}'> The least-read page
on Wikipedia</dd></dl>\n");
add("html2html", "Definition lists: colon in HTML attribute", "<dl
data-parsoid='{\"dsr\":[0,12,0,0]}'><dt data-parsoid='{\"dsr\":[0,12,1,0]}'> <b
data-parsoid='{\"dsr\":[2,12,3,3]}'>bold</b></dt></dl>\n");
add("html2html", "Definition Lists: colons and tables 1", "<dl
data-parsoid='{\"dsr\":[0,26,0,0]}'><dd data-parsoid='{\"dsr\":[0,12,1,0]}'>
<table data-parsoid='{\"dsr\":[2,12,2,2]}'>\n\n<tbody
data-parsoid='{\"dsr\":[6,10,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[6,9,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[6,9,1,0]}'>
x</td></tr>\n</tbody></table></dd>\n\n<dd data-parsoid='{\"dsr\":[14,26,1,0]}'>
<table data-parsoid='{\"dsr\":[16,26,2,2]}'>\n\n<tbody
data-parsoid='{\"dsr\":[20,24,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[20,23,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[20,23,1,0]}'>
y</td></tr>\n</tbody></table></dd></dl>\n");
+add("html2html", "! and || in element attributes should not be parsed as
<th>/<td>", "<table data-parsoid='{\"dsr\":[0,86,2,2]}'>\n<tbody
data-parsoid='{\"dsr\":[3,84,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[3,83,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[3,71,1,0]}'> <div
style=\"color: red !important;\" data-contrived=\"put this here </td><td
data-parsoid='{\"stx_v\":\"row\",\"autoInsertedEnd\":true,\"dsr\":[71,83,2,0]}'>\">hi</td></tr>\n</tbody></table>\n");
add("html2html", "Indented table markup mixed with indented pre content
(proposed in bug 6200)", " <table
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[1,59,2,0]}'>\n \n <tbody
data-parsoid='{\"dsr\":[7,59,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[7,58,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[7,58,1,0]}'>\n<pre
data-parsoid='{\"dsr\":[9,58,1,0]}'>Text that should be rendered preformatted
\n\n|}</pre></td></tr>\n</tbody></table>");
add("html2html", "Build table with wikilink", "<table class=\"wikitable\"
data-parsoid='{\"dsr\":[0,216,20,2]}'>\n\n<tbody
data-parsoid='{\"dsr\":[22,214,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[22,47,0,0]}'><th
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[22,31,1,0]}'> header
</th>\n<th data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[32,47,1,0]}'>
second header</th></tr>\n\n<tr style=\"color:red;\"
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[49,148,21,0]}'>\n<td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[71,106,1,0]}'> data <a
rel=\"mw:WikiLink\" href=\"./Wiki/Main_Page\" title=\"Wiki/Main Page\"
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Wiki/Main_Page\"},\"sa\":{\"href\":\"wiki/Main
Page\"},\"dsr\":[78,105,17,2]}'>linktext</a> </td>\n<td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[107,148,1,0]}'> second data <a
rel=\"mw:WikiLink\" href=\"./Wiki/Main_Page\" title=\"Wiki/Main Page\"
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Wiki/Main_Page\"},\"sa\":{\"href\":\"wiki/Main
Page\"},\"dsr\":[121,148,17,2]}'>linktext</a></td></tr>\n\n<tr
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[150,213,2,0]}'>\n<td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[153,160,1,0]}'> data
</td>\n<td data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[161,213,1,0]}'>
second data <a rel=\"mw:WikiLink\" href=\"./Wiki/Main_Page\" title=\"Wiki/Main
Page\"
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Wiki/Main_Page\"},\"sa\":{\"href\":\"wiki/Main
Page\"},\"dsr\":[175,213,17,2]}'>link|text with
pipe</a></td></tr>\n</tbody></table>\n");
add("html2html", "Plain link, capitalized", "<p
data-parsoid='{\"dsr\":[0,28,0,0]}'><a rel=\"mw:WikiLink\"
href=\"./Wiki/Main_Page\" title=\"Wiki/Main Page\"
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Wiki/Main_Page\"},\"sa\":{\"href\":\"wiki/Main
Page\"},\"dsr\":[0,28,17,2]}'>Main Page</a></p>\n");
@@ -892,7 +889,7 @@
add("html2wt", "Magic Word: {{PAGENAMEE}}",
"%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason\n");
add("html2wt", "Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)",
"<nowiki>*</nowiki>RFC_1234_http://example.com/\n");
add("html2wt", "Magic Word: {{REVISIONID}}", "1337\n");
-add("html2wt", "Magic Word: {{SCRIPTPATH}}", "/\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");
@@ -1071,8 +1068,6 @@
add("html2wt", "div with unquoted attribute", "<div id=\"rock\">HTML
rocks</div>\n");
add("html2wt", "div with illegal double attributes", "<div id=\"b\">HTML
rocks</div>\n");
add("html2wt", "div with empty attribute value, space before equals", "<div
class=\"\">HTML rocks</div>\n");
-add("html2wt", "div with multiple empty attribute values", "<div id=\"\"
title=\"\">HTML rocks</div>\n");
-add("html2wt", "table with multiple empty attribute values", "{| title=\"\"
id=\"\"\n| hi\n|}\n");
add("html2wt", "HTML multiple attributes correction", "Awesome!\n");
add("html2wt", "Table multiple attributes correction", "{|\n\n!
class=\"awesome\" | status\n|}\n");
add("html2wt", "DIV IN UPPERCASE", "<div id=\"x\">HTML ROCKS</div>\n");
@@ -1085,7 +1080,6 @@
add("html2wt", "Character reference normalization in link text (bug 1938)",
"[[wiki/Main Page|this&that]]\n");
add("html2wt", "(bug 19451) Links should refer to the normalized form.",
"[[wiki/אַ|אַ]]\n[[wiki/אַ|אַ]]\n[[wiki/אַ|אַ]]\n[[wiki/אַ|אַ]]\n[[wiki/אַ|אַ]]\n");
add("html2wt", "Empty attribute crash test single-quotes (bug 2067)", "<font
color=\"\">foo</font>\n");
-add("html2wt", "Attribute test: equals, then nothing", "<font>foo</font>\n");
add("html2wt", "Attribute test: unquoted value", "<font
color=\"x\">foo</font>\n");
add("html2wt", "Attribute test: unquoted but illegal value (hash)", "<font
color=\"#x\">foo</font>\n");
add("html2wt", "Bug 2095: link with pipe and three closing brackets, version
2", "[[Main Page|<nowiki>[http://example.com/]</nowiki>]]\n");
@@ -1314,9 +1308,6 @@
add("html2wt", "HRs: 1. Single line", "--------\n----=foo=\n----*foo");
add("html2wt", "3. Leading whitespace in indent-pre suppressing contexts
should not be escaped", "<blockquote>\n\n a\n <span>b</span>\n
c\n</blockquote>");
add("html2wt", "HTML tag with 'unnecessary' entity encoding in attributes",
"<span title=\"&\">foo</span>\n");
-add("html2wt", "HTML tag with broken attribute value quoting", "<span
title=\"Hello world\">Foo</span>\n");
-add("html2wt", "Table with broken attribute value quoting", "{|\n\n|
title=\"Hello world\" |Foo\n|}\n");
-add("html2wt", "Table with broken attribute value quoting on consecutive
lines", "{|\n\n| title=\"Hello world\" |Foo\n| style=\"color: red\"
|Bar\n|}\n");
add("html2wt", "2. Parsoid-only: Don't wrap broken template tags in <nowiki>
on wt2wt (Bug 42353)", "<nowiki>{{}}</nowiki>");
add("html2wt", "1. Parsoid-only: Don't wrap broken template tags in <nowiki>
on wt2wt (Bug 42353)", "<nowiki>}}{{</nowiki>");
add("html2wt", "Accept empty td cell attribute", "{|\n\n| align=\"center\" |
foo \n|\n|}\n");
@@ -1562,6 +1553,14 @@
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) [[3,[[2],0]]]",
"{|\n|otq3btd8klf2yb9\n|Cell:|broken\n|}");
add("selser", "Invalid attributes in table cell (bug 1830) [[0,[1,3]]]",
"{|\n|Cell:|broken\n|}");
+add("selser", "! and || in element attributes should not be parsed as
<th>/<td> [[0,[0,2]]]", "{|\n| <div style=\"color: red !important;\"
data-contrived=\"put this here ||\">hi</div><!--768pk9dhuiz77gb9-->\n|}");
+add("selser", "! and || in element attributes should not be parsed as
<th>/<td> [[2,2]]", "{|<!--6x6nmghv3o1g7gb9-->\n<!--02ex0q4ti0t6s9k9-->| <div
style=\"color: red !important;\" data-contrived=\"put this here
||\">hi</div>\n|}");
+add("selser", "! and || in element attributes should not be parsed as
<th>/<td> [[0,[2,3]]]", "{|\n<!--2gjjc0tjnzlac3di-->| <div style=\"color: red
!important;\" data-contrived=\"put this here ||\">hi</div>\n|}");
+add("selser", "! and || in element attributes should not be parsed as
<th>/<td> [[4,1]]", "{|<!--5o9uhp5or2hp8pvi-->\n| <div style=\"color: red
!important;\" data-contrived=\"put this here ||\">hi</div>\n|}");
+add("selser", "! and || in element attributes should not be parsed as
<th>/<td> [[3,2]]", "{|<!--97k7uhewx6flxr-->\n| <div style=\"color: red
!important;\" data-contrived=\"put this here ||\">hi</div>\n|}");
+add("selser", "! and || in element attributes should not be parsed as
<th>/<td> [[0,2]]", "{|\n<!--4geia2gf0fwdn29-->| <div style=\"color: red
!important;\" data-contrived=\"put this here ||\">hi</div>\n|}");
+add("selser", "! and || in element attributes should not be parsed as
<th>/<td> [[0,[[[3],0],0]]]", "{|\n|||\">hi</div>\n|}");
+add("selser", "! and || in element attributes should not be parsed as
<th>/<td> [2]", "rvse1pnm4h1tt9\n{|\n| <div style=\"color: red !important;\"
data-contrived=\"put this here ||\">hi</div>\n|}");
add("selser", "Table attributes with empty value [2]",
"ypqzbga8qxeqm2t9\n{|\n| style=| hello\n|}");
add("selser", "Table attributes with empty value [1]", "{|
data-foobar=\"s45owse4wvw5qaor\"\n| style=| hello\n|}");
add("selser", "Table attributes with empty value [[0,[1,3]]]", "{|\n| style=|
hello\n|}");
@@ -1820,24 +1819,6 @@
add("selser", "div with empty attribute value, space before equals [[2]]",
"<div class =>3fqgfx491jpgmn29HTML rocks</div>");
add("selser", "div with empty attribute value, space before equals [2]",
"atspk6wrqu2fbt9<div class =>HTML rocks</div>");
add("selser", "div with empty attribute value, space before equals [[4]]",
"<div class =>2xod4lmv4362bj4i</div>");
-add("selser", "div with multiple empty attribute values [2]",
"p93h8sy5ajaif6r<div id= title=>HTML rocks</div>");
-add("selser", "div with multiple empty attribute values [[2]]", "<div id=
title=>01i7ikmgcgs6ecdiHTML rocks</div>");
-add("selser", "div with multiple empty attribute values [[4]]", "<div id=
title=>x9nrx77oh6j8xgvi</div>");
-add("selser", "table with multiple empty attribute values [[0,[3,0]]]", "{|
title= id=\n\n|}");
-add("selser", "table with multiple empty attribute values [2]",
"wwxmra6xzz146lxr\n{| title= id=\n| hi\n|}");
-add("selser", "table with multiple empty attribute values [[3,2]]", "{| title=
id=<!--88ii6mcs0d7k3xr-->\n| hi\n|}");
-add("selser", "table with multiple empty attribute values [[3,[3,0]]]", "{|
title= id=\n|}");
-add("selser", "table with multiple empty attribute values [[0,4]]", "{| title=
id=\n<!--5qngsvi364mtpgb9-->|}");
-add("selser", "table with multiple empty attribute values [[4,[[3],0]]]", "{|
title= id=<!--xa0f2j67khzx5hfr-->\n|}");
-add("selser", "table with multiple empty attribute values [[3,[0,3]]]", "{|
title= id=\n| hi\n|}");
-add("selser", "table with multiple empty attribute values [[4,4]]", "{| title=
id=<!--4brzf82txx0f6r--><!--aga4s6sud3elv7vi-->\n|}");
-add("selser", "table with multiple empty attribute values [[2,[1,0]]]", "{|
title= id=<!--e1s5hmq7hzxv42t9-->\n| hi\n|}");
-add("selser", "table with multiple empty attribute values [[0,[1,2]]]", "{|
title= id=\n| hi<!--brr78m9h7xyzm2t9-->\n|}");
-add("selser", "table with multiple empty attribute values [[0,[[2],4]]]", "{|
title= id=\n|5ypmucf58060f6r\n| hi<!--uc3sgd94ff9u23xr-->\n|}");
-add("selser", "table with multiple empty attribute values [[3,[[3],2]]]", "{|
title= id=<!--odxv72lp9d6uhaor-->\n|}");
-add("selser", "table with multiple empty attribute values [[3,[3,4]]]", "{|
title= id=<!--7it3cs273176tj4i-->\n|}");
-add("selser", "table with multiple empty attribute values [[2,3]]", "{| title=
id=<!--t44fa0c0id0ftj4i-->\n|}");
-add("selser", "table with multiple empty attribute values [[0,1]]", "{| title=
id=\n| hi\n|}");
add("selser", "HTML multiple attributes correction [2]", "w1pqe1dx8ko9lik9<p
class=\"error\" class=\"awesome\">Awesome!</p>");
add("selser", "HTML multiple attributes correction [[4]]", "<p class=\"error\"
class=\"awesome\">mx2dt2hekoojq0k9</p>");
add("selser", "HTML multiple attributes correction [[2]]", "<p class=\"error\"
class=\"awesome\">ngsrrvn0y5app66rAwesome!</p>");
@@ -1875,11 +1856,6 @@
add("selser", "Empty attribute crash test single-quotes (bug 2067) [2]",
"5kxneyilny2gwrk9\n\n<font color=''>foo</font>");
add("selser", "Empty attribute crash test single-quotes (bug 2067) [[[4]]]",
"<font color=''>or63pvpg3ooxyldi</font>");
add("selser", "Empty attribute crash test single-quotes (bug 2067) [[2]]",
"3338p71nnksrwwmi<font color=''>foo</font>");
-add("selser", "Attribute test: equals, then nothing [[[2]]]", "<font
color=>b4apzz6sm3yjh5mifoo</font>");
-add("selser", "Attribute test: equals, then nothing [1]", "<font
color=>foo</font>");
-add("selser", "Attribute test: equals, then nothing [[2]]",
"87im60tsjjrlik9<font color=>foo</font>");
-add("selser", "Attribute test: equals, then nothing [2]",
"gvgrthbhrdlsor\n\n<font color=>foo</font>");
-add("selser", "Attribute test: equals, then nothing [[[4]]]", "<font
color=>olbsou2xaxxbt9</font>");
add("selser", "Attribute test: unquoted value [2]", "vl44x5rpkeyzxgvi\n\n<font
color=x>foo</font>");
add("selser", "Attribute test: unquoted value [[[2]]]", "<font
color=x>vk3nzgtza6f20529foo</font>");
add("selser", "Attribute test: unquoted value [1]", "<font
color=x>foo</font>");
@@ -2272,31 +2248,6 @@
add("selser", "Entities in ref name [2,3,0]", "uoi5udkn099vygb9\n\n<ref
name=\"test & me\">hi</ref><references />");
add("selser", "Entities in ref name [1,3,0]", "<ref name=\"test &
me\">hi</ref><references />");
add("selser", "Entities in ref name [1,4,0]", "<ref name=\"test &
me\">hi</ref>\n\np6wq2v8daq0k9<references />");
-add("selser", "HTML tag with broken attribute value quoting [1]", "<span
title=\"Hello world>Foo</span>");
-add("selser", "HTML tag with broken attribute value quoting [2]",
"zlkpme7jgj76tj4i\n\n<span title=\"Hello world>Foo</span>");
-add("selser", "HTML tag with broken attribute value quoting [[2]]",
"19ydfukj49zoajor<span title=\"Hello world>Foo</span>");
-add("selser", "HTML tag with broken attribute value quoting [[[2]]]", "<span
title=\"Hello world>fyepmud2kknbfbt9Foo</span>");
-add("selser", "HTML tag with broken attribute value quoting [[[4]]]", "<span
title=\"Hello world>60gwvgo5ggidaemi</span>");
-add("selser", "Table with broken attribute value quoting [2]",
"mr20rqhubuwstt9\n{|\n| title=\"Hello world|Foo\n|}");
-add("selser", "Table with broken attribute value quoting [[0,[2,0]]]",
"{|\n<!--ntjtaez0pi0h33di-->| title=\"Hello world|Foo\n|}");
-add("selser", "Table with broken attribute value quoting [[4,1]]",
"{|<!--aai5lsutuhht1emi-->\n| title=\"Hello world|Foo\n|}");
-add("selser", "Table with broken attribute value quoting [[0,[[[2]],0]]]",
"{|\n| title=\"Hello world|5ra5tvh3r39grpb9Foo\n|}");
-add("selser", "Table with broken attribute value quoting [[0,1]]", "{|\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<!--ndtyo6dy2iou5wmi-->\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]]", "{|<!--e45oiux5ebmg3nmi-->\n| 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|}");
-add("selser", "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", "Table with broken attribute value quoting on consecutive lines
[2]", "g4iu5aji4bwqaor\n{|\n| title=\"Hello world|Foo\n|
style=\"color:red|Bar\n|}");
-add("selser", "Table with broken attribute value quoting on consecutive lines
[[0,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,0]]]", "{|<!--vmfsvz1xmlrz4cxr-->\n| title=\"Hello world|Foo\n|
style=\"color:red|Bar\n|}");
-add("selser", "Table with broken attribute value quoting on consecutive lines
[[0,[[[2],3,3],0]]]", "{|\n| title=\"Hello world|b04knn3whm5nrk9Foo\n|}");
-add("selser", "Table with broken attribute value quoting on consecutive lines
[[4,[[[3],0,0],0]]]", "{|<!--xx6pmaat1ma0dx6r-->\n| title=\"Hello world\" |\n|
style=\"color:red|Bar\n|}");
-add("selser", "Table with broken attribute value quoting on consecutive lines
[[4,[[1,0,0],0]]]", "{|<!--nejaqckt9hmbcsor-->\n| title=\"Hello world\"
data-foobar=\"bumvfdcvrbhme7b9\" |Foo\n| style=\"color:red|Bar\n|}");
-add("selser", "Table with broken attribute value quoting on consecutive lines
[[4,2]]", "{|<!--7wm4bxgh5f0w9udi--><!--xv1dekuqzsiw9udi-->\n| 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|}");
add("selser", "Trailing newlines in a deep dom-subtree that ends a wikitext
line should be migrated out [2,4,2]",
"oxcq39cyuk07wrk9\n{|\n|<small>foo\nbar\n|}\nbtnbac04guj46lxr\n\ni10ii39io6hqto6r\n{|\n|<small>foo<small>\n|}");
add("selser", "Trailing newlines in a deep dom-subtree that ends a wikitext
line should be migrated out [[0,[[1],4]],3,[0,[[[[4,0]]],0]]]", "{|\n|
data-foobar=\"6esm1j2nehup7gb9\"
|<small>foo\nbar<!--t9z6766d6n06yldi-->\n|}\n{|\n|<small>4j0561nruz19vn29<small>\n|}");
add("selser", "Trailing newlines in a deep dom-subtree that ends a wikitext
line should be migrated out [2,0,3]",
"zx1dph1o9tpam7vi\n{|\n|<small>foo\nbar\n|}\n");
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 447f6d6..cb701e1 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -2520,6 +2520,7 @@
</p>
!! end
+## PHP parser discards the "<pre " string
!! test
Handle broken pre-like tags (bug 64025)
!! options
@@ -2530,13 +2531,8 @@
<table><pre </table>
!! html/php
<pre>x</pre>
-<table><pre </table>
+<table><pre></pre></table>
-!! html/php+tidy
-<pre>
-x
-</pre>
-<p><pre</p>
!! html/parsoid
<pre about="#mwt1" typeof="mw:Transclusion"
data-parsoid='{"a":{"<pre":null},"sa":{"<pre":""},"stx":"html","pi":[[{"k":"1"}]]}'
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre
<pre>x</pre>"}},"i":0}}]}'>x</pre>
@@ -6334,6 +6330,24 @@
<td data-parsoid='{"startTagSrc":"|
","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink"
href="ftp://|x||"></a>"
onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
!! end
+!! test
+! and || in element attributes should not be parsed as <th>/<td>
+!! wikitext
+{|
+| <div style="color: red !important;" data-contrived="put this here
||">hi</div>
+|}
+!! html/php
+<table>
+<tr>
+<td> <div style="color: red !important;" data-contrived="put this here
||">hi</div>
+</td></tr></table>
+
+!! html/parsoid
+<table>
+<tbody><tr><td> <div style="color: red !important;" data-contrived="put this
here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
+</tbody></table>
+!! end
+
# FIXME: The output seems broken. Filed as T110268.
!! test
! and || in td attributes should not be parsed as <th>/<td>
@@ -6551,14 +6565,18 @@
!! end
-# FIXME: Preserve the attribute properly (with an empty string as value) in
-# the PHP parser. Parsoid implements the behavior below.
!! test
Table attributes with empty value
!! wikitext
{|
| style=| hello
|}
+!! html/php
+<table>
+<tr>
+<td style=""> hello
+</td></tr></table>
+
!! html/parsoid
<table>
<tbody>
@@ -9799,8 +9817,7 @@
!! wikitext
{{SCRIPTPATH}}
!! html
-<p>/
-</p>
+
!! end
!! test
@@ -10964,8 +10981,6 @@
!! wikitext
<includeonly>
!! html/php
-<p><includeonly>
-</p>
!! html/parsoid
<meta typeof="mw:Includes/IncludeOnly"
data-parsoid='{"src":"<includeonly>"}'/>
!! end
@@ -15454,12 +15469,8 @@
!!end
-# FIXME: produce empty string instead of "class" in the PHP parser, following
-# the HTML5 spec.
!! test
div with empty attribute value, space before equals
-!! options
-parsoid
!! wikitext
<div class =>HTML rocks</div>
!! html
@@ -15467,26 +15478,36 @@
!! end
+# FIXME: Parsoid doesn't match the html5 spec
!! test
div with multiple empty attribute values
!! options
-parsoid
+parsoid=wt2html,html2html
!! wikitext
<div id= title=>HTML rocks</div>
-!! html
-<div id="" title="">HTML rocks</div>
+!! html/php
+<div id="title.3D">HTML rocks</div>
+!! html/parsoid
+<div id="" title="">HTML rocks</div>
!! end
+# FIXME: Parsoid doesn't match the html5 spec
!! test
table with multiple empty attribute values
!! options
-parsoid
+parsoid=wt2html,html2html
!! wikitext
{| title= id=
| hi
|}
-!! html
+!! html/php
+<table title="id=">
+<tr>
+<td> hi
+</td></tr></table>
+
+!! html/parsoid
<table title="" id="">
<tbody><tr><td> hi</td></tr>
</tbody></table>
@@ -15503,13 +15524,6 @@
<div title="{}">Foo</div>
!! end
-# This it very inconsistent in the PHP parser: it returns
-# class="class" if there is a space between the name and the equal sign (see
-# 'div with empty attribute value, space before equals'), but strips the
-# attribute completely if the space is missing. We hope that not much content
-# depends on this, so are implementing the behavior below in Parsoid for
-# consistencies' sake.
-# FIXME: fix this behavior in the PHP parser?
!! test
div with empty attribute value, no space before equals
!! options
@@ -15517,7 +15531,7 @@
!! wikitext
<div class=>HTML rocks</div>
!! html/php
-<div>HTML rocks</div>
+<div class="">HTML rocks</div>
!! html/parsoid
<div class="">HTML rocks</div>
@@ -15838,8 +15852,8 @@
Attribute test: equals, then nothing
!! wikitext
<font color=>foo</font>
-!! html
-<p><font>foo</font>
+!! html/php
+<p><font color="">foo</font>
</p>
!! end
@@ -23245,8 +23259,8 @@
<a rel="nofollow" class="external text" href="http://google.com">google]</a>
</p><p>[http://google.com]
</p><p>[http://google.com google]
-</p><p>[<a rel="nofollow" class="external text"
href="http://google.com">http://google.com</a>]
-</p><p>[<a rel="nofollow" class="external text"
href="http://google.com">http://google.com</a>]
+</p><p>[<a rel="nofollow" class="external free"
href="http://google.com">http://google.com</a>]
+</p><p>[<a rel="nofollow" class="external free"
href="http://google.com">http://google.com</a>]
</p>
!! end
@@ -23263,7 +23277,7 @@
[[http://google.com]]
!! html/php
<p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
-<p>[<a rel="nofollow" class="external autonumber"
href="http://google.com">[1]</a>]
+</p><p>[<a rel="nofollow" class="external autonumber"
href="http://google.com">[1]</a>]
</p>
!! end
@@ -23942,14 +23956,15 @@
!! test
HTML tag with broken attribute value quoting
+!! options
+parsoid=wt2html,html2html
!! wikitext
<span title="Hello world>Foo</span>
!! html/php
<p><span title="Hello world">Foo</span>
</p>
!! html/parsoid
-<p><span title="Hello world">Foo</span>
-</p>
+<p><span title="Hello world">Foo</span></p>
!! end
!! test
@@ -23967,6 +23982,8 @@
!! test
Table with broken attribute value quoting
+!! options
+parsoid=wt2html,html2html
!! wikitext
{|
| title="Hello world|Foo
@@ -23987,6 +24004,8 @@
!! test
Table with broken attribute value quoting on consecutive lines
+!! options
+parsoid=wt2html,html2html
!! wikitext
{|
| title="Hello world|Foo
diff --git a/tools/fetch-parserTests.txt.js b/tools/fetch-parserTests.txt.js
index 56cc45c..56a21b4 100755
--- a/tools/fetch-parserTests.txt.js
+++ b/tools/fetch-parserTests.txt.js
@@ -12,9 +12,9 @@
// and update these hashes automatically.
//
// You can use 'sha1sum -b tests/parser/parserTests.txt' to compute this value:
-var expectedSHA1 = "821f33fdf9751ddcd85b503b8aa9f934e2e06985";
+var expectedSHA1 = "757fbe6bc60e17ab530238c0ceccc9fe1b434227";
// git log --pretty=oneline -1 tests/parser/parserTests.txt
-var latestCommit = "67b0c669a57d097e85b1eeda5e8e7b510ee53df8";
+var latestCommit = "88d7413ddff9bdcdfd65e3f2b05e0ec457ee891a";
var fs = require('fs');
var path = require('path');
--
To view, visit https://gerrit.wikimedia.org/r/272834
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic23f7f144f22e361d3edf2cded28fed4cd17320b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits