jenkins-bot has submitted this change and it was merged.
Change subject: Don't allow quotes in generic_attribute_name
......................................................................
Don't allow quotes in generic_attribute_name
* They're invalid characters.
* Unties the attribute name production from att_value.
* Cleans up the expected html in one test, which was incorrect.
* The rest of the changes to the blacklist seem reasonable.
* Fixes the crasher in:
enwiki/List_of_Linux_distributions_that_run_from_RAM?oldid=633661716
Change-Id: Idd7f8f0103bac6928d217352b355b41a3af21f2b
---
M lib/pegTokenizer.pegjs.txt
M tests/parserTests-blacklist.js
M tests/parserTests.txt
3 files changed, 59 insertions(+), 46 deletions(-)
Approvals:
Subramanya Sastry: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index c857da1..05dddd1 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -1396,18 +1396,22 @@
// }
// Also eat these chars in a wikitext table or tr attribute name. They are
-// normally not matched by the attribute_preprocessor_text_line.
-broken_table_attribute_name_char = c:[ \t>\[] { return new KV(c, ''); }
+// normally not matched by the generic_attribute_name.
+broken_table_attribute_name_char = c:[ \t\0/=>"'\[] { return new KV(c, ''); }
+// The arrangement of chars is to emphasize the split between what's disallowed
+// by html5 and what's necessary to give directive a chance.
generic_attribute_name
- = & { return stops.push( 'equal', true ); }
- name:attribute_preprocessor_text_line
- {
- stops.pop( 'equal' );
- //console.warn( 'generic attribute name: ' + pp( name ) );
- return name;
- }
- / & { return stops.pop( 'equal' ); }
+ = r:( ts:[^ \t\0\n\r/=>"'!<&\[\]|{}]+ { return ts.join(''); }
+ / ! inline_breaks
+ ! '/>'
+ // /=>"' is the html5 attribute name set we do not want.
+ // \[ is to avoid eating links. (see: BUG 553: link with two
variables in a piped link)
+ t:( directive / !( space_or_newline / [\[/=>"'] ) c:. { return c; }
+ ) { return t; }
+ )+ {
+ return tu.flatten_string( r );
+ }
// A generic attribute, possibly spanning multiple lines.
generic_attribute_newline_value
@@ -2189,7 +2193,7 @@
// Variants with the entire attribute on a single line
attribute_preprocessor_text_line
- = r:( ts:[^=<>{\n\r&'"\t \[\]|{}/!]+ { return ts.join(''); }
+ = r:( ts:[^=<>\n\r&'"\t \[\]|{}/!]+ { return ts.join(''); }
/ !inline_breaks
! '/>'
t:(
diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index a54869c..dba8800 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -56,7 +56,6 @@
add("wt2html", "Broken image links with HTML captions (bug 39700)", "<meta
typeof=\"mw:Placeholder\"
data-parsoid='{\"src\":\"[[File:Nonexistent|<script></script>]]\",\"optList\":[{\"ck\":\"caption\",\"ak\":\"<script></script>\"}],\"dsr\":[0,38,null,null]}'/>\n<meta
typeof=\"mw:Placeholder\"
data-parsoid='{\"src\":\"[[File:Nonexistent|100px|<script></script>]]\",\"optList\":[{\"ck\":\"width\",\"ak\":\"100px\"},{\"ck\":\"caption\",\"ak\":\"<script></script>\"}],\"dsr\":[39,83,null,null]}'/>\n<meta
typeof=\"mw:Placeholder\"
data-parsoid='{\"src\":\"[[File:Nonexistent|&lt;]]\",\"optList\":[{\"ck\":\"caption\",\"ak\":\"&lt;\"}],\"dsr\":[84,109,null,null]}'/>\n<meta
typeof=\"mw:Placeholder\"
data-parsoid='{\"src\":\"[[File:Nonexistent|a<i>b</i>c]]\",\"optList\":[{\"ck\":\"caption\",\"ak\":\"a<i>b</i>c\"}],\"dsr\":[110,141,null,null]}'/>");
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", "Handling html with a div self-closing tag", "<div title=\"\"
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[0,13,13,0]}'></div>\n<div
title=\"\"
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[14,26,12,0]}'></div>\n<div
data-parsoid='{\"stx\":\"html\",\"a\":{\"title/\":null},\"sa\":{\"title/\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[27,93,13,0]}'>\n<div
title=\"bar\"
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[41,58,17,0]}'></div>\n<div
title=\"bar\"
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[59,75,16,0]}'></div>\n<div
title=\"bar/\"
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[76,93,17,0]}'></div></div>");
add("wt2html", "2. Lists with start-of-line-transparent tokens before bullets:
Template close", "<ul about=\"#mwt1\" typeof=\"mw:Transclusion\"
data-parsoid='{\"dsr\":[0,18,0,0],\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"src\":\"*foo
{{echo|bar\\n}}\"}' data-mw='{\"parts\":[\"*foo
\",{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"bar\\n\"}},\"i\":0}}]}'><li
data-parsoid='{\"dsr\":[0,null,1,0]}'>foo bar</li></ul><span about=\"#mwt1\"
data-parsoid=\"{}\">\n</span><p data-parsoid='{\"dsr\":[18,22,0,0]}'>*baz</p>");
add("wt2html", "Multiple list tags generated by templates", "<li
about=\"#mwt1\" typeof=\"mw:Transclusion\"
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[0,44,null,null],\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}],[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}],[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]]}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"<li>\"}},\"i\":0}},\"a\\n\",{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"<li>\"}},\"i\":1}},\"b\\n\",{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"<li>\"}},\"i\":2}},\"c\"]}'>a\n</li><li
about=\"#mwt1\"
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true}'>b\n</li><li
about=\"#mwt1\"
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[null,44,null,0]}'>c</li>");
add("wt2html", "Test the li-hack\n(The PHP parser relies on Tidy for the
hack)", "<ul data-parsoid='{\"dsr\":[0,114,0,0]}'><li
data-parsoid='{\"dsr\":[0,5,1,0]}'> foo</li>\n<li
data-parsoid='{\"stx\":\"html\",\"dsr\":[6,19,6,null],\"liHackSrc\":\"*
\"}'>li-hack</li>\n<li about=\"#mwt1\" typeof=\"mw:Transclusion\"
data-parsoid='{\"stx\":\"html\",\"dsr\":[20,52,2,null],\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"liHackSrc\":\"*
\"}'
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"<li>templated
li-hack\"}},\"i\":0}}]}'>templated li-hack</li>\n<li
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[53,66,1,0]}'> <!--foo-->
</li><li data-parsoid='{\"stx\":\"html\",\"dsr\":[66,114,4,null]}'> unsupported
li-hack with preceding comments</li></ul>\n\n<ul
data-parsoid='{\"stx\":\"html\",\"dsr\":[116,154,4,5]}'>\n<li
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[121,125,4,0]}'></li><li
data-parsoid='{\"stx\":\"html\",\"dsr\":[125,148,4,5]}'>not a
li-hack\n</li>\n</ul>");
@@ -241,6 +240,7 @@
add("wt2html", "Sanitizer: Validating that <meta> and <link> work, but only
for Microdata", "<div itemscope=\"\"
data-parsoid='{\"stx\":\"html\",\"dsr\":[0,308,15,6]}'>\n\t<p
data-parsoid='{\"dsr\":[17,301,0,0]}'><meta itemprop=\"hello\"
content=\"world\">\n\t<meta http-equiv=\"refresh\"
content=\"5\">\n\t<meta itemprop=\"hello\" http-equiv=\"refresh\"
content=\"5\">\n\t<link itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link
rel=\"stylesheet\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
itemprop=\"hello\" href=\"{{SERVER}}\"></p>\n</div>");
add("wt2html", "Language converter: output gets cut off unexpectedly (bug
5757)", "<p data-parsoid='{\"dsr\":[0,20,0,0]}'>this bit is safe: }-</p>\n\n<p
data-parsoid='{\"dsr\":[22,82,0,0]}'>but if we add a conversion instance:
-{zh-cn:xxx;zh-tw:yyy}-</p>\n\n<p data-parsoid='{\"dsr\":[84,112,0,0]}'>then we
get cut off here: }-</p>\n\n<p data-parsoid='{\"dsr\":[114,145,0,0]}'>all
additional text is vanished</p>");
add("wt2html", "Self closed html pairs (bug 5487)", "<center
data-parsoid='{\"stx\":\"html\",\"dsr\":[0,47,8,9]}'><font id=\"bug\"
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[8,25,17,0]}'></font>Centered
text</center>\n<div
data-parsoid='{\"stx\":\"html\",\"dsr\":[48,88,5,6]}'><font id=\"bug2\"
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[53,71,18,0]}'></font>In
div text</div>");
+add("wt2html", "Fuzz testing: Parser13", "<table data-parsoid='{\"a\":{\"
\":null},\"sa\":{\"
\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[0,15,3,0]}'>\n<tbody
data-parsoid='{\"dsr\":[4,15,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[4,15,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[4,15,1,0]}'> <a
rel=\"mw:ExtLink\" href=\"http://a|\"
data-parsoid='{\"stx\":\"url\",\"dsr\":[6,15,0,0]}'>http://a|</a></td></tr></tbody></table>");
add("wt2html", "Fuzz testing: Parser14", "<h2
data-parsoid='{\"dsr\":[0,18,2,2]}'> onmouseover= </h2>\n<p
data-parsoid='{\"dsr\":[19,33,0,0]}'><a rel=\"mw:ExtLink\"
href=\"http://__TOC__\"
data-parsoid='{\"stx\":\"url\",\"dsr\":[19,33,0,0]}'>http://__TOC__</a></p>");
add("wt2html", "Fuzz testing: Parser14-table", "<h2
data-parsoid='{\"dsr\":[0,5,2,2]}'>a</h2>\n<table style=\"__TOC__\"
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[6,22,16,0]}'></table>");
add("wt2html", "Fuzz testing: Parser24", "<p
data-parsoid='{\"fostered\":true,\"autoInsertedEnd\":true,\"dsr\":[0,0]}'><span
typeof=\"mw:Nowiki\"
data-parsoid='{\"src\":\"{{{\",\"dsr\":[3,6,0,0]}'>{{{</span>|\n<u class=\"|\"
about=\"#mwt2\" typeof=\"mw:ExpandedAttrs\"
data-parsoid='{\"stx\":\"html\",\"a\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}}\":null},\"sa\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}}\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[8,0,74,0]}'
data-mw='{\"attribs\":[[{\"txt\":\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}\",\"html\":\"<span
about=\\\"#mwt1\\\" typeof=\\\"mw:Param\\\"
data-parsoid=\\\"{&quot;dsr&quot;:[20,79,null,null],&quot;src&quot;:&quot;{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}&quot;}\\\">{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--&gt;}}}</span>}\"},{\"html\":\"\"}]]}'>\n<br
style=\"onmouseover='alert(document.cookie);' \"
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[83,0,53,0]}'/></u></p><p
data-parsoid='{\"fostered\":true,\"autoInsertedEnd\":true,\"dsr\":[0,0]}'><u
class=\"|\" about=\"#mwt2\" typeof=\"mw:ExpandedAttrs\"
data-parsoid='{\"stx\":\"html\",\"a\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}}\":null},\"sa\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}}\":\"\"},\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[-37,0,0,0]}'
data-mw='{\"attribs\":[[{\"txt\":\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}\",\"html\":\"<span
about=\\\"#mwt1\\\" typeof=\\\"mw:Param\\\"
data-parsoid=\\\"{&quot;dsr&quot;:[20,79,null,null],&quot;src&quot;:&quot;{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}&quot;}\\\">{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--&gt;}}}</span>}\"},{\"html\":\"\"}]]}'>MOVE
YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[0,177,2,0]}'>\n\n\n\n<tbody
data-parsoid='{\"dsr\":[176,177,0,0]}'><tr
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[176,177,0,0]}'><td
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[176,177,1,0]}'></td></tr></tbody></table>");
@@ -467,8 +467,8 @@
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", "Piped link with multiple pipe characters in link text", "[[Main
Page|<nowiki>|The|Main|Page|</nowiki>]]\n");
add("wt2wt", "Parsoid-centric test: Whitespace in ext- and wiki-links should
be preserved", "[[Foo| bar]]\n\n[[Foo| ''bar'']]\n\n[http://wp.org
foo]\n\n[http://wp.org ''foo'']\n");
-add("wt2wt", "Handling html with a div self-closing tag", "<div title=\"\"
/>\n<div title=\"\" />\n<div title/>\n<div title=\"bar\" />\n<div title=\"bar\"
/>\n<div title=\"bar/\">");
-add("wt2wt", "Handling html with a br self-closing tag", "<br title=\"\"
/>\n<br title=\"\" />\n<br title/>\n<br title=\"bar\" />\n<br title=\"bar\"
/>\n<br title=\"bar/\">\n");
+add("wt2wt", "Handling html with a div self-closing tag", "<div title=\"\"
/>\n<div title=\"\" />\n<div title=\"\" />\n<div title=\"bar\" />\n<div
title=\"bar\" />\n<div title=\"bar/\">");
+add("wt2wt", "Handling html with a br self-closing tag", "<br title=\"\"
/>\n<br title=\"\" />\n<br title=\"\" />\n<br title=\"bar\" />\n<br
title=\"bar\" />\n<br title=\"bar/\">\n");
add("wt2wt", "Horizontal ruler (should it add that extra space?)",
"<hr>\n<hr>\nfoo <hr> bar\n");
add("wt2wt", "Nested lists 3 (first element empty)", "\n**bar\n");
add("wt2wt", "Nested lists 6 (both elements empty)", "\n**\n");
@@ -513,7 +513,7 @@
add("wt2wt", "Sanitizer: Closing of closed but not open tags", "");
add("wt2wt", "Sanitizer: Closing of closed but not open table tags", "Table
not started");
add("wt2wt", "Sanitizer: Validating that <meta> and <link> work, but only for
Microdata", "<div itemscope=\"\">\n\t<nowiki><meta itemprop=\"hello\"
content=\"world\">\n\t<meta http-equiv=\"refresh\" content=\"5\">\n\t<meta
itemprop=\"hello\" http-equiv=\"refresh\" content=\"5\">\n\t<link
itemprop=\"hello\" href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\"
href=\"{{SERVER}}\">\n\t<link rel=\"stylesheet\" itemprop=\"hello\"
href=\"{{SERVER}}\"></nowiki>\n</div>");
-add("wt2wt", "Fuzz testing: Parser13", "{| \n| http://a |\n|}");
+add("wt2wt", "Fuzz testing: Parser13", "{| \n| http://a|\n|}");
add("wt2wt", "Fuzz testing: Parser14-table", "==a==\n{|
style=\"__TOC__\"\n|}");
add("wt2wt", "Fuzz testing: Parser16", "{|\n!https://||||||\n|}");
add("wt2wt", "Fuzz testing: Parser21", "{|\n! irc://{{ftp://a\"
onmouseover=\"alert('hello world');\"\n|\n|}");
@@ -1159,7 +1159,7 @@
add("html2wt", "<br> to <br />", "1\n2\n3\n");
add("html2wt", "Incorrecly removing closing slashes from correctly formed
XHTML", "\n");
add("html2wt", "Failing to transform badly formed HTML into correct XHTML",
"\n\n\n");
-add("html2wt", "Handling html with a div self-closing tag", "<nowiki><div
title />\n<div title/></nowiki>\n\n<div>\n<nowiki><div title=bar />\n<div
title=bar/></nowiki>\n\n<div title=\"bar/\"></div>\n</div>\n");
+add("html2wt", "Handling html with a div self-closing tag", "<div title=\"\"
/>\n<div title=\"\" />\n<div title=\"\" />\n<div title=\"bar\" />\n<div
title=\"bar\" />\n<div title=\"bar/\">");
add("html2wt", "Handling html with a br self-closing tag", "\n\n\n\n\n\n");
add("html2wt", "Horizontal ruler (should it add that extra space?)",
"----\n----\nfoo\n----\nbar\n");
add("html2wt", "Horizontal ruler -- eats additional dashes on the same line",
"----\n");
@@ -2208,26 +2208,26 @@
add("selser", "Parsoid-centric test: Whitespace in ext- and wiki-links should
be preserved [0,2,1,3,[[4]],3,0]", "[[Foo| bar]]\n\ncpt8orwf0l26s9k9\n\n[[Foo|
''bar'']]\n\n[http://wp.org e15bwsd59u73c8fr]\n\n[http://wp.org ''foo'']");
add("selser", "Parsoid-centric test: Whitespace in ext- and wiki-links should
be preserved [3,4,4,2,2,4,0]",
"o3awmbfvt9fnu3di\n\nj0e1avrz9scvunmi\n\npvsdo8qneqe8w7b9\n\nou4krycgek8uayvi\n\n[http://wp.org
foo]\n\nu9e32ytur700ms4i\n\n[http://wp.org ''foo'']");
add("selser", "Interlanguage link variations [3,2,2,0,1,2,1,3,0]",
"pzmy6p9svhen4s4i\n\nqzc7qhlkpbbuik9[[ es :Spanish]]\n[[ ZH
:Chinese]]3ql21qt70gam7vi\n[[es:Foo_bar]]\n[[es:Foo bar]]");
-add("selser", "Handling html with a div self-closing tag [0,0,4,0,1]", "<div
title />\na2lmqbelulg6tj4i\n<div data-foobar=\"myfxsa4q14jf9a4i\" title/>\n<div
title=\"bar\" />\n<div title=\"bar\" />\n<div title=\"bar/\">");
-add("selser", "Handling html with a div self-closing tag [0,2,3,0,1]", "<div
title />hsvg8qvys3q8h0k9\n\n<div data-foobar=\"pmcyv89r6fq7iudi\" title/>\n<div
title=\"bar\" />\n<div title=\"bar\" />\n<div title=\"bar/\">");
-add("selser", "Handling html with a div self-closing tag
[0,2,0,2,[0,1,2,4,3,1]]", "<div title />hrkbg93g91mdkj4i\n<div
title/>d24otck8en4s4i\n<div title/>\n<div title=\"bar\"
data-foobar=\"m3try3iqp9fi529\" />40lnev3wvt4t2o6r\n5cg171a8bz7aatt9<div
title=\"bar/\" data-foobar=\"ht3kiuub2yv6lxr\">");
-add("selser", "Handling html with a div self-closing tag
[4,0,0,0,[2,2,0,0,0,2]]", "m2l4sqf9jovzehfr\n<div title/>\n<div
title/>wqgi12lyu5l8fr\n9qt8023po9smunmi<div title=bar />\n<div
title=bar/>\n3komwccrkiysyvi<div title=bar/ >");
-add("selser", "Handling html with a div self-closing tag [0,0,1,0,3]", "<div
title />\n<div title=\"\" data-foobar=\"akdgg69qx6jvpldi\" />\n");
-add("selser", "Handling html with a div self-closing tag [0,0,1,4,2]", "<div
title />\n<div title=\"\" data-foobar=\"5h27qgatlrw9udi\"
/>bq5ubiyv65x3l3di\n\nf7wbxz7wtcblnmi<div title/ >\n<div title=bar />\n<div
title=bar/>\n<div title=bar/ >");
-add("selser", "Handling html with a div self-closing tag
[3,3,0,3,[0,0,4,0,0,4]]", "<div title/><div title/>\n<div title=\"bar\"
/>nebjm3qen9l4bo6r<div title=\"bar\" />\npp3d9ptaj68ncdi\n");
-add("selser", "Handling html with a div self-closing tag [0,4,0,2,2]", "<div
title />0cxt91hns1c3di<div title/>5fmhlouu0049rudi\nzfddnll4v5s1c3di<div title/
>\n<div title=bar />\n<div title=bar/>\n<div title=bar/ >");
-add("selser", "Handling html with a div self-closing tag [0,2,4,0,3]", "<div
title />eywpqn9mosd4e7b9\nrj74969g5jm26gvi\n");
-add("selser", "Handling html with a div self-closing tag [0,0,4,3,3]", "<div
title />\n3a2ar4hcg8s0dx6r\n");
-add("selser", "Handling html with a div self-closing tag [0,0,0,2,4]", "<div
title />\n<div title/>3yg021t2l4841jor\nrtcytjxmokw0o1or\n");
-add("selser", "Handling html with a div self-closing tag [0,3,1,0,4]", "<div
title /><div title=\"\" data-foobar=\"26b6vcigdn53ik9\"
/>\ncsd55mrpw7g8ehfr\n");
-add("selser", "Handling html with a div self-closing tag [0,3,0,4,1]", "<div
title /><div title/>0z1eukxmytaz6w29<div data-foobar=\"jzl0rmosd4e7b9\"
title/>\n<div title=\"bar\" />\n<div title=\"bar\" />\n<div title=\"bar/\">");
-add("selser", "Handling html with a div self-closing tag
[2,4,0,0,[0,1,4,0,2,0]]", "y8e35sgnm62prpb9<div title />gdi8pd4889pv6lxr<div
title/>\n<div title/>\n<div title=\"bar\" data-foobar=\"yw0irzjxo48l4n29\"
/>r91jtf9r9lgfd2t9<div title=bar/>2vkbfb0puakmx6r\n<div title=bar/ >");
-add("selser", "Handling html with a div self-closing tag [0,3,3,3,3]", "<div
title />");
-add("selser", "Handling html with a div self-closing tag
[2,3,4,2,[2,0,0,0,0,3]]", "vqocw5cb4ax4unmi<div title
/>dvekdalavcygmn29\n\nl7myvzectyo2bj4i\n<div title/>h8p91en5mk4vx6r\n<div
title=\"bar\" />\n<div title=\"bar\" />\n");
-add("selser", "Handling html with a div self-closing tag
[0,4,3,0,[3,0,0,0,0,0]]", "<div title />dmd8ofkx0b3dte29\n<div title/><div
title=\"bar\" />\n<div title=\"bar\" />\n<div title=\"bar/\">");
-add("selser", "Handling html with a div self-closing tag [1,0,0,0,4]", "<div
title=\"\" data-foobar=\"s9is41y68ko9lik9\" />\n<div
title/>\n6ra1fmqrs0s5rk9\n");
-add("selser", "Handling html with a div self-closing tag [0,0,4,0,0]", "<div
title />\nhzdq9cp5d0zr529\n<div title/ >\n<div title=bar />\n<div
title=bar/>\n<div title=bar/ >");
-add("selser", "Handling html with a div self-closing tag [0,0,3,0,2]", "<div
title />\n\n0ay5a9dpj8m2t9<div title/ >\n<div title=bar />\n<div
title=bar/>\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,0,4,0,1,0,1,0,3,4,3]", "<div title />\na2lmqbelulg6tj4i\n<div title=\"\"
data-foobar=\"myfxsa4q14jf9a4i\" />\n<div title=\"bar\"
data-foobar=\"16l4nxten48wipb9\" />\nfjaqot6n6yfogvi\n");
+add("selser", "Handling html with a div self-closing tag
[0,2,3,0,1,3,4,0,0,0,2]", "<div title />hsvg8qvys3q8h0k9\n\n<div title=\"\"
data-foobar=\"pmcyv89r6fq7iudi\" />i3jrozlq6c4n29\n<div
title=bar/>\n50f5viswvgoav2t9<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,2,0,2,0,0,1,2,4,3,1]", "<div title />hrkbg93g91mdkj4i\n<div
title/>d24otck8en4s4i\n<div title/ >\n<div title=\"bar\"
data-foobar=\"m3try3iqp9fi529\" />40lnev3wvt4t2o6r\n5cg171a8bz7aatt9<div
title=\"bar/\" data-foobar=\"ht3kiuub2yv6lxr\">");
+add("selser", "Handling html with a div self-closing tag
[4,0,0,0,0,2,2,0,0,0,2]", "m2l4sqf9jovzehfr\n<div title/>\n<div title/
>wqgi12lyu5l8fr\n9qt8023po9smunmi<div title=bar />\n<div
title=bar/>\n3komwccrkiysyvi<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,0,1,0,3,3,1,0,0,4,1]", "<div title />\n<div title=\"\"
data-foobar=\"akdgg69qx6jvpldi\" />\n<div title=\"bar\"
data-foobar=\"6n0svo7xzqudte29\" />\n<div title=bar/>4flrs91zux1dcxr<div
title=\"bar/\" data-foobar=\"i2a2v7rh1bawcdi\">");
+add("selser", "Handling html with a div self-closing tag
[0,0,1,4,2,0,0,0,1,0,3]", "<div title />\n<div title=\"\"
data-foobar=\"5h27qgatlrw9udi\" />bq5ubiyv65x3l3di\n\nf7wbxz7wtcblnmi<div
title/ >\n<div title=bar />\n<div title=\"bar\" data-foobar=\"c0zta55kk1yk3xr\"
/>\n");
+add("selser", "Handling html with a div self-closing tag
[3,3,0,3,0,0,0,4,0,0,4]", "<div title/><div title/ >\n<div title=bar
/>nebjm3qen9l4bo6r<div title=bar/>\npp3d9ptaj68ncdi\n");
+add("selser", "Handling html with a div self-closing tag
[0,4,0,2,2,0,3,0,1,0,0]", "<div title />0cxt91hns1c3di<div
title/>5fmhlouu0049rudi\nzfddnll4v5s1c3di<div title/ >\n\n<div title=\"bar\"
data-foobar=\"voxs0rgm1hdgf1or\" />\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,2,4,0,3,2,0,0,4,0,0]", "<div title
/>eywpqn9mosd4e7b9\nrj74969g5jm26gvi\n\nyn204pmfqr3mzpvi\n<div title=bar
/>\n27sa4fad4vtmlsor\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,0,4,3,3,3,2,0,4,0,0]", "<div title
/>\n3a2ar4hcg8s0dx6r\n\nttluv421ma0dx6r<div title=bar
/>\n47mk0eu0s70evcxr\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,0,0,2,4,4,4,3,4,0,0]", "<div title />\n<div
title/>3yg021t2l4841jor\nrtcytjxmokw0o1or\n\n66b89ill6r8jjor\n\nv3cnlc0zuissjor\n\n8i8ngbo80ngbvs4i\n<div
title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,3,1,0,4,4,0,0,0,0,0]", "<div title /><div title=\"\"
data-foobar=\"26b6vcigdn53ik9\" />\ncsd55mrpw7g8ehfr\n\nptl9msxol22ihpvi<div
title=bar />\n<div title=bar/>\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,3,0,4,1,4,0,0,1,3,3]", "<div title /><div title/>0z1eukxmytaz6w29<div
title=\"\" data-foobar=\"jzl0rmosd4e7b9\" />l4blqbnipmgnl8fr<div title=bar
/>\n<div title=\"bar\" data-foobar=\"hkios7mkkjra4i\" />");
+add("selser", "Handling html with a div self-closing tag
[2,4,0,0,0,0,1,4,0,2,0]", "y8e35sgnm62prpb9<div title />gdi8pd4889pv6lxr<div
title/>\n<div title/ >\n<div title=\"bar\" data-foobar=\"yw0irzjxo48l4n29\"
/>r91jtf9r9lgfd2t9<div title=bar/>2vkbfb0puakmx6r\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,3,3,3,3,2,1,4,4,2,0]", "<div title />5vjj77i8fepwg66r\n<div title=\"bar\"
data-foobar=\"lhriiksge1dobt9\"
/>l6hqmr0097knvcxr\n\nlt88ef091p833di\n\nvbqt2pdljfko6r\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[2,3,4,2,0,2,0,0,0,0,3]", "vqocw5cb4ax4unmi<div title
/>dvekdalavcygmn29\n\nl7myvzectyo2bj4i\n<div title/ >h8p91en5mk4vx6r\n<div
title=bar />\n<div title=bar/>\n");
+add("selser", "Handling html with a div self-closing tag
[0,4,3,0,0,3,0,0,0,0,0]", "<div title />dmd8ofkx0b3dte29\n<div title/ ><div
title=bar />\n<div title=bar/>\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[1,0,0,0,4,0,0,2,0,0,0]", "<div title=\"\" data-foobar=\"s9is41y68ko9lik9\"
/>\n<div title/>\n6ra1fmqrs0s5rk9\n<div title=bar />1csgf1pq50yq4cxr\n<div
title=bar/>\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,0,4,0,0,0,0,0,0,0,0]", "<div title />\nhzdq9cp5d0zr529\n<div title/ >\n<div
title=bar />\n<div title=bar/>\n<div title=bar/ >");
+add("selser", "Handling html with a div self-closing tag
[0,0,3,0,2,2,4,4,3,0,2]", "<div title />\n\n0ay5a9dpj8m2t9<div title/
>q5rd7rel0immfgvi\nei4ya9wclabdquxr\n\n10kcirb4x2u1h5mi\nnp5b3z79bl6jemi<div
title=bar/ >");
add("selser", "Handling html with a br self-closing tag
[[0,2,2,0,0,3,0,4,0,0,0]]", "<br title />ca3n9qal18yw4s4i\nqj9uz1bwmfbw3ik9<br
title/>\n<br title/ ><br title=bar />b6yshcv3dptx1or<br title=bar/>\n<br
title=bar/ >");
add("selser", "Handling html with a br self-closing tag [2]",
"zikmxl9l7vte29\n\n<br title />\n<br title/>\n<br title/ >\n<br title=bar
/>\n<br title=bar/>\n<br title=bar/ >");
add("selser", "Handling html with a br self-closing tag [1]", "<br title
/>\n<br title/>\n<br title/ >\n<br title=bar />\n<br title=bar/>\n<br
title=bar/ >");
@@ -2236,11 +2236,11 @@
add("selser", "Handling html with a br self-closing tag
[[0,0,2,4,0,2,3,2,0,4,0]]", "<br title />\n97qdfbkc1d8nz5mi<br
title/>51ea25u22napp66r<br title/ >ao31pgxz80ti6bt9\niczt3hqwep5e9udi\n<br
title=bar/>hyg2ncqmqe7gy14i<br title=bar/ >");
add("selser", "Handling html with a br self-closing tag
[[2,0,0,3,0,0,0,4,0,0,0]]", "0ubgji48lso1dcxr<br title />\n<br title/><br
title/ >\n<br title=bar />bnkuwblgntf647vi<br title=bar/>\n<br title=bar/ >");
add("selser", "Handling html with a br self-closing tag
[[3,0,0,2,4,4,0,0,0,3,2]]", "\n<br
title/>tak6jp65ijsmj9k9\n5dyugkaawpd86w29tsl2xmucx9k3ayvi<br title=bar />\n<br
title=bar/>dqcr689mput2zkt9<br title=bar/ >");
-add("selser", "Handling html with a br self-closing tag
[[0,4,1,4,1,0,0,0,0,3,0]]", "<br title />33x6padp4n7y14i<br title=\"\"
data-foobar=\"s32ku8ygk5d0a4i\" />2r1tqohm9vxqolxr<br
data-foobar=\"s21sk2l9fiuow29\" title/>\n<br title=bar />\n<br title=bar/><br
title=bar/ >");
+add("selser", "Handling html with a br self-closing tag
[[0,4,1,4,1,0,0,0,0,3,0]]", "<br title />33x6padp4n7y14i<br title=\"\"
data-foobar=\"s32ku8ygk5d0a4i\" />2r1tqohm9vxqolxr<br title=\"\"
data-foobar=\"s21sk2l9fiuow29\" />\n<br title=bar />\n<br title=bar/><br
title=bar/ >");
add("selser", "Handling html with a br self-closing tag
[[2,2,0,2,0,0,0,0,0,0,1]]", "4mon4sx8d75vcxr<br title />cq9odu9ftnxhto6r\n<br
title/>mllazr81dckxogvi\n<br title/ >\n<br title=bar />\n<br title=bar/>\n<br
title=\"bar/\" data-foobar=\"azit67rektb4vx6r\">");
add("selser", "Handling html with a br self-closing tag
[[0,0,0,4,2,4,1,0,3,0,0]]", "<br title />\n<br
title/>xxxx2l29fkmrhpvihskx3wdt3p11nhfr<br title/ >7z6kganc7xrvbo6r<br
title=\"bar\" data-foobar=\"oqi7lfhelkpujtt9\" />\n\n<br title=bar/ >");
add("selser", "Handling html with a br self-closing tag
[[1,0,4,0,0,4,0,2,0,0,0]]", "<br title=\"\" data-foobar=\"2imakz3vrgam7vi\"
/>\nky2cjkk76dc2fbt9\n<br title/ >xl4j77qpveso47vi<br title=bar
/>65xmmggrk28iwwmi\n<br title=bar/>\n<br title=bar/ >");
-add("selser", "Handling html with a br self-closing tag
[[0,0,0,2,1,0,0,2,4,0,0]]", "<br title />\n<br title/>ijzdh4uerc8oajor\n<br
data-foobar=\"i9otejvc98eka9k9\" title/>\n<br title=bar
/>puumi6qcjg3w61or\ntw74kiaxwe6a8aor\n<br title=bar/ >");
+add("selser", "Handling html with a br self-closing tag
[[0,0,0,2,1,0,0,2,4,0,0]]", "<br title />\n<br title/>ijzdh4uerc8oajor\n<br
title=\"\" data-foobar=\"i9otejvc98eka9k9\" />\n<br title=bar
/>puumi6qcjg3w61or\ntw74kiaxwe6a8aor\n<br title=bar/ >");
add("selser", "Handling html with a br self-closing tag
[[0,0,0,4,0,0,2,0,3,0,4]]", "<br title />\n<br title/>5obz7gcvgrv0a4i<br title/
>\n1zf4ljohfm0lik9<br title=bar />\n\n766rcon9lcbzw7b9\n");
add("selser", "Handling html with a br self-closing tag
[[0,3,0,2,0,4,0,2,0,3,3]]", "<br title /><br title/>irxhfbe46ofg8pvi\n<br
title/ >jlxc4655va38fr<br title=bar />ok12d02ne9udi\n<br title=bar/>\n");
add("selser", "Handling html with a br self-closing tag
[[1,3,0,0,4,0,2,0,0,3,0]]", "<br title=\"\" data-foobar=\"qk9iqlffataqncdi\"
/><br title/>\nyut18a54lpu8fr\nv0kplvxcj8gds4i<br title=bar />\n<br
title=bar/><br title=bar/ >");
@@ -2541,17 +2541,16 @@
add("selser", "HTML nested bullet list, open tags (bug 5497)
[[4,[3],2,[0,4],3]]",
"<ul><li>x7e4pzqkzu2fbt9</li><li><li>zz9wcy7ovlipy14i</li>\n<li>Two:\nz6aoj185m56ogvi\n\n</ul>");
add("selser", "HTML nested ordered list, closed tags (bug 5497)
[[2,1,4,[0,4,3],3]]", "<ol><li>xkvf7lec17wg66r</li>\n<li
data-foobar=\"lsd14sl7dm927qfr\">One</li><li>czwfizqug7vz33di</li><li>Two:\nu30q3qpwbmswz5mi\n</li>\n</ol>");
add("selser", "Fuzz testing: Parser13 [2]", "whfwe630sy8pvi\n{| \n|
http://a|");
-add("selser", "Fuzz testing: Parser13 [[0,[[1]]]]", "{| \n|
data-foobar=\"bz304nhr12359udi\" http://a ||}");
+add("selser", "Fuzz testing: Parser13 [[0,[[1]]]]", "{| \n|
data-foobar=\"bz304nhr12359udi\" | http://a||}");
add("selser", "Fuzz testing: Parser13 [1]", "{|
data-foobar=\"k83lm0w7lheyiudi\" \n| http://a||}");
add("selser", "Fuzz testing: Parser13 [[2,2]]", "{|
<!--ot0k5hk2dibe29-->\n<!--ddndi7e9wtlkrzfr-->| http://a||}");
add("selser", "Fuzz testing: Parser13 [[4,2]]", "{|
<!--5r0vu1d4d02akyb9--><!--kgfqc1jnmjyh9f6r-->\n| http://a||}");
add("selser", "Fuzz testing: Parser13 [[0,1]]", "{| \n| http://a||}");
add("selser", "Fuzz testing: Parser13 [[0,2]]", "{|
\n<!--aox6m05qx79icnmi-->| http://a||}");
add("selser", "Fuzz testing: Parser13 [[0,[1]]]", "{| \n| http://a||}");
-add("selser", "Fuzz testing: Parser13 [[2,[[1]]]]", "{|
<!--k7dytmk4x4fpf1or-->\n| data-foobar=\"6eljtbwlg39dx6r\" http://a ||}");
+add("selser", "Fuzz testing: Parser13 [[2,[[1]]]]", "{|
<!--k7dytmk4x4fpf1or-->\n| data-foobar=\"6eljtbwlg39dx6r\" | http://a||}");
add("selser", "Fuzz testing: Parser13 [[4,[1]]]", "{|
<!--bc5lt7d97qcwhfr-->\n| http://a||}");
-add("selser", "Fuzz testing: Parser13 [[4,0]]", "{| <!--bdcj5y141zcl3di-->\n|
http://a||}");
-add("selser", "Fuzz testing: Parser13 [[2,0]]", "{|
<!--fk6xcjz25vc84cxr-->\n| http://a||}");
+add("selser", "Fuzz testing: Parser13 [[2,[[[4,2]]]]]", "{|
<!--fk6xcjz25vc84cxr-->\n|vg3mb5k49pvw8kt90uv1ti9ejcg6tj4i<nowiki/>http://a||}");
add("selser", "Fuzz testing: Parser14-table [1,0,0]", "==a==\n{|
STYLE=__TOC__");
add("selser", "Fuzz testing: Parser14-table [4,4,0]",
"u98ofogyawwb3xr\n\ntty3c40hu0gujtt9\n{| STYLE=__TOC__");
add("selser", "Fuzz testing: Parser14-table [0,2,0]",
"==a==\nu14a8f95rx8q6w29\n{| STYLE=__TOC__");
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 37b4559..d064f54 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -16,7 +16,7 @@
# cat add category links
# ill add inter-language links
# subpage enable subpages (disabled by default)
-# noxml don't check for XML well formdness
+# noxml don't check for XML well-formedness
# title=[[XXX]] run test using article title XXX
# language=XXX set content language to XXX for this test
# variant=XXX set the variant of language for this test (eg zh-tw)
@@ -2254,7 +2254,8 @@
<table><pre></pre></table>
!! html/parsoid
-<p typeof="mw:Transclusion"
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre
<pre>x</pre>"}},"i":0}}]}'><pre </p><pre>x</pre>
+<pre about="#mwt1" typeof="mw:Transclusion"
data-parsoid='{"a":{"<pre":null},"sa":{"<pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}'
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre
<pre>x</pre>"}},"i":0}}]}'>x</pre>
+
<p><pre </p>
@@ -7423,6 +7424,8 @@
</p>
!!end
+## FIXME: Is Parsoid's acceptance of self-closing html-tags
+## a feature or a bug? See https://phabricator.wikimedia.org/T76962
!! test
Handling html with a div self-closing tag
!! wikitext
@@ -7432,7 +7435,7 @@
<div title=bar />
<div title=bar/>
<div title=bar/ >
-!! html
+!! html/php
<p><div title />
<div title/>
</p>
@@ -7443,6 +7446,13 @@
<div title="bar/"></div>
</div>
+!! html/parsoid
+<div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
+<div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
+<div title=""
data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
+<div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
+<div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
+<div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
!! end
!! test
@@ -7465,7 +7475,7 @@
!! html/parsoid
<p><br title="" />
<br title="" />
-<br />
+<br title="" />
<br title="bar" />
<br title="bar" />
<br title="bar/" />
--
To view, visit https://gerrit.wikimedia.org/r/173212
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idd7f8f0103bac6928d217352b355b41a3af21f2b
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Marcoil <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits