Subramanya Sastry has uploaded a new change for review. https://gerrit.wikimedia.org/r/237694
Change subject: Revert "Nowiki protection of | isn't needed when preceded by [[" ...................................................................... Revert "Nowiki protection of | isn't needed when preceded by [[" This reverts commit a07e20905fba5bd7330cc0846b9acebe5f67f895. This makes that test more complex, doesn't work in all scenarios and will anyway get reverted a part of another patch I am working on. The nowiki added for this test is not such a big deal right now. Change-Id: Ifb958ac2f820fbac7d5f8ab1cd1aeaddc18937d5 --- M lib/wts.escapeWikitext.js M tests/parserTests-blacklist.js 2 files changed, 12 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/94/237694/1 diff --git a/lib/wts.escapeWikitext.js b/lib/wts.escapeWikitext.js index 6d3c6c8..576349d 100644 --- a/lib/wts.escapeWikitext.js +++ b/lib/wts.escapeWikitext.js @@ -201,8 +201,7 @@ // * +- in SOL position (if they show up on the leftmost path with // only zero-wt-emitting nodes on that path) return (!opts.node || state.currLine.firstNode === tdNode) && - // The convoluted test here is to account for T2553. - ((state.currLine.text + text).match(/^((?!\[\[)[^|])*\|/) || ( + (text.match(/\|/) || ( !state.inWideTD && state.currLine.text === '' && text.match(/^[\-+]/) && diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js index 3246a26..b7a4961 100644 --- a/tests/parserTests-blacklist.js +++ b/tests/parserTests-blacklist.js @@ -350,6 +350,7 @@ add("wt2wt", "Template with invalid target containing unclosed tag", "<nowiki>{{</nowiki>a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a =b<nowiki>}}</nowiki>\n"); add("wt2wt", "Template with invalid target containing wikilink", "<nowiki>{{</nowiki>[[Main Page]]<nowiki>}}</nowiki>\n"); add("wt2wt", "Template with argument in separate line", "{{templateasargtest |\n templ = simple }}"); +add("wt2wt", "BUG 553: link with two variables in a piped link", "{|\n|[[{{{1}}}<nowiki>|</nowiki>{{{2}}}]]\n|}"); add("wt2wt", "Abort table cell attribute parsing on wikilink", "{|\n| testing [[one|two]]<nowiki> | three </nowiki>|| four\n| testing one two | three || four\n|}"); add("wt2wt", "Template with targets containing wikilinks", "<nowiki>{{</nowiki>[[foo]]<nowiki>}}</nowiki>\n\n<nowiki>{{</nowiki>[[{{echo|foo}}]]<nowiki>}}</nowiki>\n\n{{{{echo|[[foo}}]]}}\n"); add("wt2wt", "2. includeonly in html attr value", "<span id=\"<noinclude>v1</noinclude><includeonly>v2</includeonly>\">bar</span>\n<span id=\"<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>\">bar</span>\n"); @@ -492,6 +493,7 @@ add("html2html", "Template with invalid target containing wikilink", "<p data-parsoid='{\"dsr\":[0,17,0,0]}'>{{<a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[2,15,2,2]}'>Main Page</a>}}</p>\n"); add("html2html", "Template unnamed parameter", "<p data-parsoid='{\"dsr\":[0,32,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,32,17,2]}'>the main page</a></p>\n"); add("html2html", "Template with complex arguments", "<p data-parsoid='{\"dsr\":[0,84,0,0]}'><a rel=\"mw:WikiLink\" href=\"./Wiki/Template:Complextemplate\" title=\"Wiki/Template:Complextemplate\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Wiki/Template:Complextemplate\"},\"sa\":{\"href\":\"wiki/Template:Complextemplate\"},\"dsr\":[0,38,32,2]}'>link</a> This is a test template with parameter (test)</p>\n"); +add("html2html", "BUG 553: link with two variables in a piped link", "<table data-parsoid='{\"dsr\":[0,43,2,2]}'>\n<tbody data-parsoid='{\"dsr\":[3,41,0,0]}'><tr data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[3,40,0,0]}'><td data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[3,40,1,0]}'><meta typeof=\"mw:Placeholder\" data-parsoid='{\"src\":\"[[{{{1}}}<nowiki>|</nowiki>{{{2}}}]]\",\"dsr\":[4,40,null,null]}'/></td></tr>\n</tbody></table>\n"); add("html2html", "Abort table cell attribute parsing on wikilink", "<table data-parsoid='{\"dsr\":[0,94,2,2]}'>\n<tbody data-parsoid='{\"dsr\":[3,92,0,0]}'><tr data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[3,91,0,0]}'><td data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[3,50,1,0]}'> testing <a rel=\"mw:WikiLink\" href=\"./One\" title=\"One\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./One\"},\"sa\":{\"href\":\"one\"},\"dsr\":[13,24,6,2]}'>two</a><span typeof=\"mw:Nowiki\" data-parsoid='{\"dsr\":[24,50,8,9]}'> | three </span></td><td data-parsoid='{\"stx_v\":\"row\",\"autoInsertedEnd\":true,\"dsr\":[50,57,2,0]}'> four</td>\n<td data-parsoid='{\"a\":{\"testing\":null,\"one\":null,\"two\":null},\"sa\":{\"testing\":\"\",\"one\":\"\",\"two\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[58,84,19,0]}'> three </td><td data-parsoid='{\"stx_v\":\"row\",\"autoInsertedEnd\":true,\"dsr\":[84,91,2,0]}'> four</td></tr>\n</tbody></table>\n"); add("html2html", "Template parameter as link source", "<p data-parsoid='{\"dsr\":[0,23,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,23,17,2]}'>link</a></p>\n"); add("html2html", "Template as link source", "<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\n<p data-parsoid='{\"dsr\":[30,58,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\":[30,58,17,2]}'>Main Page</a></p>\n\n<p data-parsoid='{\"dsr\":[60,92,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\":[60,88,17,2]}'>Main Page</a>Page</p>\n"); @@ -973,6 +975,7 @@ add("html2wt", "Template with complex template as argument", "This is a test template with parameter (test)\n"); add("html2wt", "Template with thumb image (with link in description)", "{{paramtest|param = [[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}\n"); add("html2wt", "Template with complex arguments", "[[wiki/Template:Complextemplate|link]] This is a test template with parameter (test)\n"); +add("html2wt", "BUG 553: link with two variables in a piped link", "{|\n|[[{{{1}}}<nowiki>|</nowiki>{{{2}}}]]\n|}\n"); add("html2wt", "Abort table cell attribute parsing on wikilink", "{|\n| testing [[one|two]]<nowiki> | three </nowiki>|| four\n| testing one two | three || four\n|}\n"); add("html2wt", "Magic variable as template parameter", "This is a test template with parameter MediaWiki\n"); add("html2wt", "Template parameter as link source", "[[wiki/Main Page|link]]\n"); @@ -1788,6 +1791,14 @@ add("selser", "Template with invalid target containing wikilink [[0,[2],0]]", "<nowiki>{{</nowiki>[[Main Page|g5dbrx85rnt57b9Main Page]]}}"); add("selser", "Template with invalid target containing wikilink [[4,2,0]]", "gb2u86grtumu0udigposn6eyae154s4i[[Main Page]]}}"); add("selser", "Template with invalid target containing wikilink [[3,[4],0]]", "[[Main Page|hah73egswvf2mx6r]]}}"); +add("selser", "BUG 553: link with two variables in a piped link [1]", "{| data-foobar=\"sermfvbsbpujtt9\"\n|[[{{{1}}}|{{{2}}}]]\n|}"); +add("selser", "BUG 553: link with two variables in a piped link [[0,[[[0,0,0,0,2]],2]]]", "{|\n|[[{{{1}}}|{{{2}}}67x19euoicw61or]]<!--jadn53w2sr79zfr-->\n|}"); +add("selser", "BUG 553: link with two variables in a piped link [[0,[0,4]]]", "{|\n|[[{{{1}}}|{{{2}}}]]<!--5luam4tixnbl0udi-->\n|}"); +add("selser", "BUG 553: link with two variables in a piped link [[0,[2,2]]]", "{|\n<!--2l9bvsosq2iq9f6r-->|[[{{{1}}}|{{{2}}}]]<!--f21xzcxsl9iwl8fr-->\n|}"); +add("selser", "BUG 553: link with two variables in a piped link [[0,[2,0]]]", "{|\n<!--ekt298jbktjoflxr-->|[[{{{1}}}|{{{2}}}]]\n|}"); +add("selser", "BUG 553: link with two variables in a piped link [[3,1]]", "{|\n|[[{{{1}}}|{{{2}}}]]\n|}"); +add("selser", "BUG 553: link with two variables in a piped link [2]", "riybxbthicfskyb9\n{|\n|[[{{{1}}}|{{{2}}}]]\n|}"); +add("selser", "BUG 553: link with two variables in a piped link [[0,2]]", "{|\n<!--z79xd4wgjxphw7b9-->|[[{{{1}}}|{{{2}}}]]\n|}"); add("selser", "Abort table cell attribute parsing on wikilink [1]", "{| data-foobar=\"w6muy2if0yrjm7vi\"\n| testing [[one|two]] | three || four\n| testing one two | three || four\n|}"); add("selser", "Abort table cell attribute parsing on wikilink [[0,1]]", "{|\n| testing [[one|two]] | three || four\n| testing one two | three || four\n|}"); add("selser", "Abort table cell attribute parsing on wikilink [[0,[[[2,0,0],1,0,2,[2]],4]]]", "{|\n|7s7418n1uo7uv7vi testing [[one|two]] | three || data-foobar=\"zomk9que1edygb9\" | four\n|2mhjtgea0fcg14i\n| testing one two | three ||5naus1mqi98gp66r four<!--hz9awkyqyfrbe29-->\n|}"); -- To view, visit https://gerrit.wikimedia.org/r/237694 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifb958ac2f820fbac7d5f8ab1cd1aeaddc18937d5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits