Arlolra has uploaded a new change for review.

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

Change subject: Content on table start / row is all attributes
......................................................................

Content on table start / row is all attributes

 * Fixes the regression introduced in I0e6e597e2f4eb9dfe0ded34f92aa15a83338229e

 * enwiki/Trinity_(nuclear_test)?oldid=679523451 rt's without semantic
   diffs now.

Bug: T95131
Change-Id: I0646442d27b863c6653491c43c319c3d87cf9ca5
---
M lib/pegTokenizer.pegjs.txt
M tests/parserTests-blacklist.js
M tests/parserTests.txt
3 files changed, 9 insertions(+), 20 deletions(-)


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

diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index 7053c86..a74ae3c 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -1293,14 +1293,15 @@
 
 // Same as generic_attribute_name, except for accepting tags found here.
 // (That doesn't make sense (ie. match php) in the generic case.)
-// We also give a chance to break on !|, and \[ is to avoid eating links.
+// We also give a chance to break on ! and |, and \[ is to accept wikilinks
+// while swallowing the content separator.
 // (See, BUG 553: link with two variables in a piped link)
 table_attribute_name
   = r:( $[^ \t\r\n\0/=>"'<&{}\-!|\[]+
         / !inline_breaks
-          !wikilink
           // \0/=>"' is the html5 attribute name set we do not want.
-          t:( directive
+          t:(   $wikilink
+              / directive
               // Accept insane tags-inside-attributes as attribute names.
               // The sanitizer will strip and shadow them for roundtripping.
               // Example: <hiddentext>generated with.. </hiddentext>
diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index 99f3932..9407807 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -308,7 +308,6 @@
 add("wt2html", "2. Parsoid-only: Don't wrap broken template tags in <nowiki> 
on wt2wt (Bug 42353)", "<p data-parsoid='{\"dsr\":[0,4,0,0]}'><span 
typeof=\"mw:Nowiki\" 
data-parsoid='{\"src\":\"{{}}\",\"dsr\":[0,4,0,0]}'>{{}}</span></p>");
 add("wt2html", "1. Parsoid-only: Don't wrap broken template tags in <nowiki> 
on wt2wt (Bug 42353)", "<p data-parsoid='{\"dsr\":[0,4,0,0]}'><span 
typeof=\"mw:Nowiki\" 
data-parsoid='{\"src\":\"}}{{\",\"dsr\":[0,4,0,0]}'>}}{{</span></p>");
 add("wt2html", "Empty table rows go away", "<table 
data-parsoid='{\"dsr\":[0,39,2,2]}'>\n<tbody 
data-parsoid='{\"dsr\":[3,37,0,0]}'><tr 
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[3,18,0,0]}'><td
 data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[3,10,1,0]}'> Hello</td>\n<td 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[11,18,1,0]}'> 
there</td></tr>\n<tr class=\"foo\" 
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[19,33,14,0]}'></tr>\n<tr
 
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[34,36,2,0]}'></tr>\n</tbody></table>");
-add("wt2html", "RT-ed inter-element separators should be valid separators", 
"<p 
data-parsoid='{\"fostered\":true,\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[0,0]}'><a
 rel=\"mw:WikiLink\" href=\"./Foo\" title=\"Foo\" 
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Foo\"},\"sa\":{\"href\":\"foo\"},\"autoInsertedEnd\":true,\"dsr\":[6,13,2,0]}'>foo</a></p><table
 data-parsoid='{\"dsr\":[0,16,2,2]}'>\n<tbody 
data-parsoid='{\"dsr\":[3,14,0,0]}'><tr 
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[3,12,2,0]}'></tr>
 \n</tbody></table>");
 
 
 // Blacklist for wt2wt
@@ -416,7 +415,6 @@
 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", "RT-ed inter-element separators should be valid separators", 
"[[foo]]\n{|\n|- \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");
@@ -1399,7 +1397,6 @@
 add("html2wt", "Non-empty attributes in th-cells", "{|\n\n! Foo \n! 
style=\"color: red\" | Bar\n|}\n");
 add("html2wt", "Accept empty attributes in th-cells", "{|\n\n! foo \n! 
bar\n|}\n");
 add("html2wt", "Empty table rows go away", "{|\n\n| Hello\n\n| there\n\n|}\n");
-add("html2wt", "RT-ed inter-element separators should be valid separators", 
"{|\n\n|}\n");
 add("html2wt", "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|}\n");
 add("html2wt", "Empty TD followed by TD with tpl-generated attribute", 
"{|\n\n|\n\n|foo\n|}\n");
 add("html2wt", "Indented table with an empty td", "{|\n\n|\n\n|foo\n|}\n");
@@ -2401,19 +2398,6 @@
 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", "RT-ed inter-element separators should be valid separators 
[3,1]", "{| data-foobar=\"x539yhci41xxbt9\"\n|- [[foo]]\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[1,1]", "[[foo]]\n{| data-foobar=\"0p92gdvzuuwhfr\"\n|- [[foo]]\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[0,[3,[2,4]]]", "{|<!--94t5edxysje2ke29-->\n|- 
[[foo]<!--ckb9ez0ylze3766r-->\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[4,[0,[0,3]]]", "jua9o47wi1gojemi\n{|\n|- [[foo]\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[1,[0,[0,4]]]", "[[foo]]\n{|\n|- [[foo]<!--7u4ntcstjzto6r-->\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[[[2]],2]", "[[foo|662vco2tyo8q6w29foo]]\n\nyasgjcy1y1ll3di\n{|\n|- 
[[foo]]\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[1,2]", "[[foo]]\n\n80gcqjar6qrggb9\n{|\n|- [[foo]]\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[3,0]", "{|\n|- [[foo]]\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[0,[0,4]]", "{|\n<!--j8hwklray6ekx1or-->|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[0,1]", "{| data-foobar=\"io6h5rgsuyjh5mi\"\n|- [[foo]]\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[2,[0,[0,2]]]", "qyiayk5wxhn9izfr\n\n{|\n|- [[foo]<!--l16uj38p26eqm2t9--> 
\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[2,[0,3]]", "a467voa6hewdygb9\n\n{|\n|}");
-add("selser", "RT-ed inter-element separators should be valid separators 
[4,1]", "m9sr4renr110pb9\n{| data-foobar=\"vqglzmqq4crcc8fr\"\n|- [[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 df0590e..27d1215 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -23739,11 +23739,15 @@
 {|
 |- [[foo]]
 |}
-!! html
+!! html/php
 <table>
 
 </table>
 
+!! html/parsoid
+<table>
+<tbody><tr 
data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
+</tbody></table>
 !!end
 
 # Parsoid-only since PHP parser relies on Tidy for correct output

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0646442d27b863c6653491c43c319c3d87cf9ca5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>

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

Reply via email to