Subramanya Sastry has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/328698 )

Change subject: Sync parsertests with core
......................................................................

Sync parsertests with core

* Added html/parsoid for a new test. wt2html is sufficient
  for that since the other modes will expectedly fail.

* Blacklisted the gallery failures since they are related to
  language variant code. There are patches to update Parsoid
  for that. Those patches will deal with these failing tests.

Change-Id: I8f24d9d55fa23d68f95ed66c26143b8bf44b1832
---
M tests/parserTests-blacklist.js
M tests/parserTests.txt
M tools/fetch-parserTests.txt.js
3 files changed, 221 insertions(+), 26 deletions(-)


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

diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index 94a6bac..bb03503 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -226,9 +226,11 @@
 add("wt2html", "Do not convert roman numbers to language variants", "<p 
data-parsoid='{\"dsr\":[0,18,0,0]}'>Fridrih IV je car.</p>");
 add("wt2html", "Don't convert raw rule \"-{R|=&gt;}-\" to \"=>\"", "<p 
data-parsoid='{\"dsr\":[0,11,0,0]}'>-{R|=<span typeof=\"mw:Entity\" 
data-parsoid='{\"src\":\"&amp;gt;\",\"srcContent\":\">\",\"dsr\":[5,9,null,null]}'>></span>}-</p>");
 add("wt2html", "Don't break link parsing if language converter markup is in 
the caption.", "<p data-parsoid='{\"dsr\":[0,29,0,0]}'><a rel=\"mw:WikiLink\" 
href=\"./Main_Page\" title=\"Main Page\" 
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main
 Page\"},\"dsr\":[0,29,12,2]}'>-{R|main page}-</a></p>");
-add("wt2html", "Don't break image parsing if language converter markup is in 
the caption.", "<p data-parsoid='{\"dsr\":[0,33,0,0]}'><span 
class=\"mw-default-size\" typeof=\"mw:Image\" 
data-parsoid='{\"optList\":[{\"ck\":\"bogus\",\"ak\":\"-{R\"},{\"ck\":\"caption\",\"ak\":\"caption}-\"}],\"dsr\":[0,33,null,null]}'
 data-mw='{\"caption\":\"caption}-\"}'><a href=\"./Датотека:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./Датотека:Foobar.jpg\"},\"sa\":{}}'><img 
resource=\"./Датотека:Foobar.jpg\" src=\"//example.com/images/3/3a/Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"220\" width=\"1941\" 
data-parsoid='{\"a\":{\"resource\":\"./Датотека:Foobar.jpg\",\"height\":\"220\",\"width\":\"1941\"},\"sa\":{\"resource\":\"File:Foobar.jpg\"}}'/></a></span></p>");
+add("wt2html", "T146305: Don't break image parsing if language converter 
markup is in the caption.", "<figure class=\"mw-default-size\" 
typeof=\"mw:Image/Thumb\" 
data-parsoid='{\"optList\":[{\"ck\":\"thumbnail\",\"ak\":\"thumb\"},{\"ck\":\"bogus\",\"ak\":\"-{R\"},{\"ck\":\"caption\",\"ak\":\"caption:}-\"}],\"dsr\":[0,40,2,2]}'><a
 href=\"./Датотека:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./Датотека:Foobar.jpg\"},\"sa\":{},\"dsr\":[2,null,null,null]}'><img
 resource=\"./Датотека:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"25\" width=\"220\" 
data-parsoid='{\"a\":{\"resource\":\"./Датотека:Foobar.jpg\",\"height\":\"25\",\"width\":\"220\"},\"sa\":{\"resource\":\"File:Foobar.jpg\"}}'/></a><figcaption
 
data-parsoid='{\"dsr\":[null,38,null,null]}'>caption:}-</figcaption></figure>");
+add("wt2html", "T146305: Don't break image parsing if nested language 
converter markup is in the caption.", "<figure class=\"mw-default-size\" 
typeof=\"mw:Image/Thumb\" 
data-parsoid='{\"optList\":[{\"ck\":\"thumbnail\",\"ak\":\"thumb\"},{\"ck\":\"bogus\",\"ak\":\"-{zh-cn:blog
 (hk: -{zh-hans\"},{\"ck\":\"bogus\",\"ak\":\"WEBJOURNAL}-, tw: 
-{zh-hans\"},{\"ck\":\"caption\",\"ak\":\"WEBLOG}-)}-\"}],\"dsr\":[0,93,2,2]}'><a
 href=\"./File:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Foobar.jpg\"},\"sa\":{},\"dsr\":[2,null,null,null]}'><img
 resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"25\" width=\"220\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Foobar.jpg\",\"height\":\"25\",\"width\":\"220\"},\"sa\":{\"resource\":\"File:Foobar.jpg\"}}'/></a><figcaption
 
data-parsoid='{\"dsr\":[null,91,null,null]}'>WEBLOG}-)}-</figcaption></figure>");
+add("wt2html", "Don't break gallery if language converter markup is inside.", 
"<ul class=\"gallery mw-gallery-traditional\" typeof=\"mw:Extension/gallery\" 
about=\"#mwt5\" data-parsoid='{\"dsr\":[0,172,2,2]}' 
data-mw='{\"name\":\"gallery\",\"attrs\":{},\"body\":{\"extsrc\":\"\\nFile:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-\\nFile:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt\\n\"}}'>\n<li
 class=\"gallerybox\" style=\"width: 155px;\"><div class=\"thumb\" 
style=\"width: 150px; height: 150px;\"><span style=\"display: inline-block; 
height: 100%; vertical-align: middle;\"></span><span typeof=\"mw:Image\" 
style=\"vertical-align: middle; display: inline-block;\"><a 
href=\"./File:Foobar.jpg\"><img alt=\"-{R\" resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"14\" width=\"120\"/></a></span></div><div 
class=\"gallerytext\">bat}-</div></li>\n<li class=\"gallerybox\" style=\"width: 
155px;\"><div class=\"thumb\" style=\"width: 150px; height: 150px;\"><span 
style=\"display: inline-block; height: 100%; vertical-align: 
middle;\"></span><span typeof=\"mw:Image\" style=\"vertical-align: middle; 
display: inline-block;\"><a href=\"./File:Foobar.jpg\"><img alt=\"galleryalt\" 
resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"14\" width=\"120\"/></a></span></div><div class=\"gallerytext\"><span 
about=\"#mwt4\" typeof=\"mw:Transclusion\" 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"Test\",\"href\":\"./Template:Test\"},\"params\":{\"1\":{\"wt\":\"unamedParam\"},\"2\":{\"wt\":\"param}-\"},\"alt\":{\"wt\":\"-{R\"}},\"i\":0}}]}'>This
 is a test template</span></div></li>\n</ul>");
 add("wt2html", "Don't break list handling if language converter markup is in 
the item.", "<dl data-parsoid='{\"dsr\":[0,24,0,0]}'><dt 
data-parsoid='{\"dsr\":[0,8,1,0]}'>-{zh-cn</dt><dd 
data-parsoid='{\"stx\":\"row\",\"dsr\":[8,24,1,0]}'>AAA;zh-tw:BBB}-</dd></dl>");
-add("wt2html", "Don't break table handling if language converter markup is in 
the cell.", "<table data-parsoid='{\"dsr\":[0,18,2,2]}'>\n<tbody 
data-parsoid='{\"dsr\":[3,16,0,0]}'><tr 
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[3,15,2,0]}'>\n<td
 
data-parsoid='{\"a\":{\"-{R\":null},\"sa\":{\"-{R\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[6,15,6,0]}'>B}-</td></tr>\n</tbody></table>");
+add("wt2html", "T153140: Don't break table handling if language converter 
markup is in the cell.", "<table data-parsoid='{\"dsr\":[0,18,2,2]}'>\n<tbody 
data-parsoid='{\"dsr\":[3,16,0,0]}'><tr 
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[3,15,2,0]}'>\n<td
 
data-parsoid='{\"a\":{\"-{R\":null},\"sa\":{\"-{R\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[6,15,6,0]}'>B}-</td></tr>\n</tbody></table>");
 add("wt2html", "Bug 529: Uncovered bullet in parser function result", "<ul 
data-parsoid='{\"dsr\":[0,24,0,0]}'><li data-parsoid='{\"dsr\":[0,24,1,0]}'> 
Foo <span about=\"#mwt1\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[6,24,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"lc:{{bullet}} 
\",\"function\":\"lc\"},\"params\":{},\"i\":0}}]}'> bar</span></li></ul>");
 add("wt2html", "Bug 5678: Double-parsed template invocation", "<p 
about=\"#mwt1\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[0,42,0,0],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"lc:{{paramtest {{!}} 
param = hello }} \",\"function\":\"lc\"},\"params\":{},\"i\":0}}]}'>{{paramtest 
 param = hello }}</p>");
 add("wt2html", "Case insensitivity of parser functions for non-ASCII 
characters (bug 8143)", "<p data-parsoid='{\"dsr\":[0,135,0,0]}'><span 
typeof=\"mw:Transclusion mw:Placeholder\" about=\"#mwt1\" 
data-parsoid='{\"dsr\":[0,19,null,null],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PRVNÍVELKÉ:ěščř\",\"href\":\"./PRVNÍVELKÉ:ěščř\"},\"params\":{},\"i\":0}}]}'>Warning:
 Page/template fetching disabled, and no cache for 
PRVNÍVELKÉ:ěščř</span>\n<span typeof=\"mw:Transclusion mw:Placeholder\" 
about=\"#mwt2\" data-parsoid='{\"dsr\":[20,39,null,null],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"prvnívelké:ěščř\",\"href\":\"./Prvnívelké:ěščř\"},\"params\":{},\"i\":0}}]}'>Warning:
 Page/template fetching disabled, and no cache for 
Prvnívelké:ěščř</span>\n<span typeof=\"mw:Transclusion mw:Placeholder\" 
about=\"#mwt3\" data-parsoid='{\"dsr\":[40,58,null,null],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PRVNÍMALÉ:ěščř\",\"href\":\"./PRVNÍMALÉ:ěščř\"},\"params\":{},\"i\":0}}]}'>Warning:
 Page/template fetching disabled, and no cache for PRVNÍMALÉ:ěščř</span>\n<span 
typeof=\"mw:Transclusion mw:Placeholder\" about=\"#mwt4\" 
data-parsoid='{\"dsr\":[59,77,null,null],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"prvnímalé:ěščř\",\"href\":\"./Prvnímalé:ěščř\"},\"params\":{},\"i\":0}}]}'>Warning:
 Page/template fetching disabled, and no cache for Prvnímalé:ěščř</span>\n<span 
typeof=\"mw:Transclusion mw:Placeholder\" about=\"#mwt5\" 
data-parsoid='{\"dsr\":[78,91,null,null],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"MALÁ:ěščř\",\"href\":\"./MALÁ:ěščř\"},\"params\":{},\"i\":0}}]}'>Warning:
 Page/template fetching disabled, and no cache for MALÁ:ěščř</span>\n<span 
typeof=\"mw:Transclusion mw:Placeholder\" about=\"#mwt6\" 
data-parsoid='{\"dsr\":[92,105,null,null],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"malá:ěščř\",\"href\":\"./Malá:ěščř\"},\"params\":{},\"i\":0}}]}'>Warning:
 Page/template fetching disabled, and no cache for Malá:ěščř</span>\n<span 
typeof=\"mw:Transclusion mw:Placeholder\" about=\"#mwt7\" 
data-parsoid='{\"dsr\":[106,120,null,null],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"VELKÁ:ěščř\",\"href\":\"./VELKÁ:ěščř\"},\"params\":{},\"i\":0}}]}'>Warning:
 Page/template fetching disabled, and no cache for VELKÁ:ěščř</span>\n<span 
typeof=\"mw:Transclusion mw:Placeholder\" about=\"#mwt8\" 
data-parsoid='{\"dsr\":[121,135,null,null],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"velká:ěščř\",\"href\":\"./Velká:ěščř\"},\"params\":{},\"i\":0}}]}'>Warning:
 Page/template fetching disabled, and no cache for Velká:ěščř</span></p>");
@@ -258,6 +260,11 @@
 add("wt2html", "Check noCommafy in formatNum", "<p 
data-parsoid='{\"dsr\":[0,53,0,0]}'><span about=\"#mwt1\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[0,23,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"formatnum:123456.78\",\"function\":\"formatnum\"},\"params\":{},\"i\":0}}]}'>123456.78</span>\n<span
 about=\"#mwt2\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,53,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"formatnum:123456.78\",\"function\":\"formatnum\"},\"params\":{\"1\":{\"wt\":\"NOSEP\"}},\"i\":0}}]}'>123456.78</span></p>");
 add("wt2html", "Wrong option for formatNum (bug 56199)", "<p 
data-parsoid='{\"dsr\":[0,126,0,0]}'><span about=\"#mwt1\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[0,29,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"formatnum:1,234.56\",\"function\":\"formatnum\"},\"params\":{\"1\":{\"wt\":\"Random\"}},\"i\":0}}]}'>1,234.56</span>\n<span
 about=\"#mwt2\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[30,63,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"formatnum:1,234.56\",\"function\":\"formatnum\"},\"params\":{\"1\":{\"wt\":\"EVERYTHING\"}},\"i\":0}}]}'>1,234.56</span>\n<span
 about=\"#mwt3\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[64,126,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"formatnum:1234.56\",\"function\":\"formatnum\"},\"params\":{\"1\":{\"wt\":\"any
 argument that has the string 
&#39;NOSEP&#39;\"}},\"i\":0}}]}'>1234.56</span></p>");
 add("wt2html", "Strip marker in grammar", "<p about=\"#mwt1\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"dsr\":[0,35,0,0],\"pi\":[[{\"k\":\"1\"}]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"grammar:elative\",\"function\":\"grammar\"},\"params\":{\"1\":{\"wt\":\"foo&lt;nowiki/>bar\"}},\"i\":0}}]}'>Parser
 function implementation for pf_grammar missing in Parsoid.</p>");
+add("wt2html", "Gallery override link with WikiLink (bug 34852)", "<ul 
class=\"gallery mw-gallery-traditional\" typeof=\"mw:Extension/gallery\" 
about=\"#mwt2\" data-parsoid='{\"dsr\":[0,78,2,2]}' 
data-mw='{\"name\":\"gallery\",\"attrs\":{},\"body\":{\"extsrc\":\"\\nFile:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink\\n\"}}'>\n<li
 class=\"gallerybox\" style=\"width: 155px;\"><div class=\"thumb\" 
style=\"width: 150px; height: 150px;\"><span style=\"display: inline-block; 
height: 100%; vertical-align: middle;\"></span><span typeof=\"mw:Image\" 
style=\"vertical-align: middle; display: inline-block;\"><a 
href=\"./InterWikiLink\"><img alt=\"galleryalt\" resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"14\" width=\"120\"/></a></span></div><div 
class=\"gallerytext\">caption</div></li>\n</ul>");
+add("wt2html", "Gallery override link with absolute external link (bug 
34852)", "<ul class=\"gallery mw-gallery-traditional\" 
typeof=\"mw:Extension/gallery\" about=\"#mwt2\" 
data-parsoid='{\"dsr\":[0,87,2,2]}' 
data-mw='{\"name\":\"gallery\",\"attrs\":{},\"body\":{\"extsrc\":\"\\nFile:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org\\n\"}}'>\n<li
 class=\"gallerybox\" style=\"width: 155px;\"><div class=\"thumb\" 
style=\"width: 150px; height: 150px;\"><span style=\"display: inline-block; 
height: 100%; vertical-align: middle;\"></span><span typeof=\"mw:Image\" 
style=\"vertical-align: middle; display: inline-block;\"><a 
href=\"http://www.example.org\";><img alt=\"galleryalt\" 
resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"14\" width=\"120\"/></a></span></div><div 
class=\"gallerytext\">caption</div></li>\n</ul>");
+add("wt2html", "Gallery override link with absolute external link with 
LanguageConverter", "<ul class=\"gallery mw-gallery-traditional\" 
typeof=\"mw:Extension/gallery\" about=\"#mwt2\" 
data-parsoid='{\"dsr\":[0,87,2,2]}' 
data-mw='{\"name\":\"gallery\",\"attrs\":{},\"body\":{\"extsrc\":\"\\nFile:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org\\n\"}}'>\n<li
 class=\"gallerybox\" style=\"width: 155px;\"><div class=\"thumb\" 
style=\"width: 150px; height: 150px;\"><span style=\"display: inline-block; 
height: 100%; vertical-align: middle;\"></span><span typeof=\"mw:Image\" 
style=\"vertical-align: middle; display: inline-block;\"><a 
href=\"http://www.example.org\";><img alt=\"galleryalt\" 
resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"14\" width=\"120\"/></a></span></div><div 
class=\"gallerytext\">caption</div></li>\n</ul>");
+add("wt2html", "Gallery override link with malicious javascript (bug 34852)", 
"<ul class=\"gallery mw-gallery-traditional\" typeof=\"mw:Extension/gallery\" 
about=\"#mwt2\" data-parsoid='{\"dsr\":[0,112,2,2]}' 
data-mw='{\"name\":\"gallery\",\"attrs\":{},\"body\":{\"extsrc\":\"\\nFile:foobar.jpg|caption|alt=galleryalt|link=\\\"
 onclick=\\\"alert(&#39;malicious javascript code!&#39;);\\n\"}}'>\n<li 
class=\"gallerybox\" style=\"width: 155px;\"><div class=\"thumb\" 
style=\"width: 150px; height: 150px;\"><span style=\"display: inline-block; 
height: 100%; vertical-align: middle;\"></span><span typeof=\"mw:Image\" 
style=\"vertical-align: middle; display: inline-block;\"><a 
href=\"./&quot;_onclick=&quot;alert('malicious_javascript_code!');\"><img 
alt=\"galleryalt\" resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"14\" width=\"120\"/></a></span></div><div 
class=\"gallerytext\">caption</div></li>\n</ul>");
+add("wt2html", "Gallery with invalid title as link (bug 43964)", "<ul 
class=\"gallery mw-gallery-traditional\" typeof=\"mw:Extension/gallery\" 
about=\"#mwt2\" data-parsoid='{\"dsr\":[0,43,2,2]}' 
data-mw='{\"name\":\"gallery\",\"attrs\":{},\"body\":{\"extsrc\":\"\\nFile:foobar.jpg|link=&lt;\\n\"}}'>\n<li
 class=\"gallerybox\" style=\"width: 155px;\"><div class=\"thumb\" 
style=\"width: 150px; height: 150px;\"><span style=\"display: inline-block; 
height: 100%; vertical-align: middle;\"></span><span typeof=\"mw:Image\" 
style=\"vertical-align: middle; display: inline-block;\"><a 
href=\"./File:Foobar.jpg\"><img resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"14\" width=\"120\"/></a></span></div><div 
class=\"gallerytext\">link=&lt;</div></li>\n</ul>");
 add("wt2html", "Language parser function", "<p about=\"#mwt1\" 
typeof=\"mw:Transclusion\" data-parsoid='{\"dsr\":[0,16,0,0],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#language:ar\",\"function\":\"#language\"},\"params\":{},\"i\":0}}]}'>ar</p>");
 add("wt2html", "Special parser function", "<p 
data-parsoid='{\"dsr\":[0,65,0,0]}'><span about=\"#mwt1\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[0,23,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#special:RandomPage\",\"function\":\"#special\"},\"params\":{},\"i\":0}}]}'>Parser
 function implementation for pf_#special missing in Parsoid.</span>\n<span 
about=\"#mwt2\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[24,45,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#special:BaDtItLe\",\"function\":\"#special\"},\"params\":{},\"i\":0}}]}'>Parser
 function implementation for pf_#special missing in Parsoid.</span>\n<span 
about=\"#mwt3\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[46,65,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#special:Foobar\",\"function\":\"#special\"},\"params\":{},\"i\":0}}]}'>Parser
 function implementation for pf_#special missing in Parsoid.</span></p>");
 add("wt2html", "1. SOL-sensitive wikitext tokens as template-args", "<p 
data-parsoid='{\"dsr\":[0,35,0,0]}'><span about=\"#mwt1\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[0,11,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"*a\"}},\"i\":0}}]}'>*a</span>\n<span
 about=\"#mwt2\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,23,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"#a\"}},\"i\":0}}]}'>#a</span>\n<span
 about=\"#mwt3\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,35,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\":a\"}},\"i\":0}}]}'>:a</span></p>");
@@ -345,7 +352,7 @@
 add("wt2wt", "Image with page parameter", "[[File:LoremIpsum.djvu]]\n");
 add("wt2wt", "Don't fall for the self-closing div", "<div>hello world</div>");
 add("wt2wt", "Parsing of overlapping (improperly nested) inline html tags", 
"<span><s>x</span>\n");
-add("wt2wt", "Don't break table handling if language converter markup is in 
the cell.", "{|\n|-\n| -{R |B}-\n|}");
+add("wt2wt", "T153140: Don't break table handling if language converter markup 
is in the cell.", "{|\n|-\n| -{R |B}-\n|}");
 add("wt2wt", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy", "******* Foo \n{{bullet}}");
 add("wt2wt", "HHP2.1: Heuristics for headings in preprocessor parenthetical 
structures", "<nowiki>{{foo|</nowiki>\n=heading=\n");
 add("wt2wt", "HHP2.2: Heuristics for headings in preprocessor parenthetical 
structures", "<nowiki>{{foo|</nowiki>\n==heading==\n");
@@ -559,7 +566,9 @@
 add("html2html", "Partly disable title conversion if variant == main language 
code", "<p data-parsoid='{\"dsr\":[0,2,0,0]}'>ZH</p>\n");
 add("html2html", "Partly disable title conversion if variant == main language 
code, more", "<p data-parsoid='{\"dsr\":[0,2,0,0]}'>ZH</p>\n");
 add("html2html", "Don't break link parsing if language converter markup is in 
the caption.", "<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");
-add("html2html", "Don't break image parsing if language converter markup is in 
the caption.", "<p data-parsoid='{\"dsr\":[0,41,0,0]}'><img 
src=\"http://example.com/images/3/3a/Foobar.jpg\"; alt=\"Foobar.jpg\" 
rel=\"mw:externalImage\" data-parsoid='{\"dsr\":[0,41,null,null]}'/></p>\n");
+add("html2html", "T146305: Don't break image parsing if language converter 
markup is in the caption.", "<figure class=\"mw-default-size\" 
typeof=\"mw:Image/Thumb\" 
data-parsoid='{\"optList\":[{\"ck\":\"thumbnail\",\"ak\":\"thumb\"},{\"ck\":\"caption\",\"ak\":\"&lt;span>&lt;/span>\"}],\"dsr\":[0,43,2,2]}'><a
 href=\"./Датотека:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./Датотека:Foobar.jpg\"},\"sa\":{},\"dsr\":[2,null,null,null]}'><img
 resource=\"./Датотека:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"25\" width=\"220\" 
data-parsoid='{\"a\":{\"resource\":\"./Датотека:Foobar.jpg\",\"height\":\"25\",\"width\":\"220\"},\"sa\":{\"resource\":\"Датотека:Foobar.jpg\"}}'/></a><figcaption
 data-parsoid='{\"dsr\":[null,41,null,null]}'><span 
data-parsoid='{\"stx\":\"html\",\"dsr\":[28,41,6,7]}'></span></figcaption></figure>\n");
+add("html2html", "T146305: Don't break image parsing if nested language 
converter markup is in the caption.", "<figure class=\"mw-default-size\" 
typeof=\"mw:Image/Thumb\" 
data-parsoid='{\"optList\":[{\"ck\":\"thumbnail\",\"ak\":\"thumb\"},{\"ck\":\"caption\",\"ak\":\"&lt;span>&lt;/span>\"}],\"dsr\":[0,39,2,2]}'><a
 href=\"./File:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Foobar.jpg\"},\"sa\":{},\"dsr\":[2,null,null,null]}'><img
 resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"25\" width=\"220\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Foobar.jpg\",\"height\":\"25\",\"width\":\"220\"},\"sa\":{\"resource\":\"File:Foobar.jpg\"}}'/></a><figcaption
 data-parsoid='{\"dsr\":[null,37,null,null]}'><span 
data-parsoid='{\"stx\":\"html\",\"dsr\":[24,37,6,7]}'></span></figcaption></figure>\n");
+add("html2html", "Don't break gallery if language converter markup is 
inside.", "<p data-parsoid='{\"dsr\":[0,4,0,0]}'>\t\t* </p><div style=\"width: 
155px\" data-parsoid='{\"stx\":\"html\",\"dsr\":[4,295,26,6]}'> \t\t\t<div 
class=\"thumb\" style=\"width: 150px;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[34,182,41,6]}'><div 
style=\"margin:68px auto;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[75,176,31,6]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\"; 
alt=\"120px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[106,170,null,null]}'/></div></div> \t\t\t<div 
class=\"gallerytext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[186,286,25,6]}'> 
<img src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg\"; 
alt=\"20px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[212,275,null,null]}'/>  \t\t\t</div> \t\t</div>\n<p 
data-parsoid='{\"dsr\":[296,300,0,0]}'>\t\t* </p><div style=\"width: 155px\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[300,551,26,6]}'> \t\t\t<div 
class=\"thumb\" style=\"width: 150px;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[330,478,41,6]}'><div 
style=\"margin:68px auto;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[371,472,31,6]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\"; 
alt=\"120px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[402,466,null,null]}'/></div></div> \t\t\t<div 
class=\"gallerytext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[482,542,25,6]}'> 
This is a test template  \t\t\t</div> \t\t</div>\n");
 add("html2html", "Free external link invading image caption", "<div 
class=\"thumb tright\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[0,236,26,6]}'><div 
class=\"thumbinner\" style=\"width:182px;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[26,230,45,6]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg\"; 
alt=\"180px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[71,135,null,null]}'/>  <div class=\"thumbcaption\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[137,224,26,6]}'><div class=\"magnify\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[163,213,21,6]}'>[/wiki/File:Foobar.jpg]</div>hello</div></div></div>\n");
 add("html2html", "Bad images - basic functionality", "<p 
data-parsoid='{\"dsr\":[0,16,0,0]}'><span class=\"mw-default-size\" 
typeof=\"mw:Error mw:Image\" 
data-parsoid='{\"optList\":[],\"dsr\":[0,16,null,null]}' 
data-mw='{\"errors\":[{\"key\":\"missing-image\",\"message\":\"This image does 
not exist.\"}]}'><a href=\"./File:Bad.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Bad.jpg\"},\"sa\":{}}'><img 
resource=\"./File:Bad.jpg\" src=\"./Special:FilePath/Bad.jpg\" height=\"220\" 
width=\"220\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Bad.jpg\",\"height\":\"220\",\"width\":\"220\"},\"sa\":{\"resource\":\"File:Bad.jpg\"}}'/></a></span></p>\n");
 add("html2html", "Bad images - bug 16039: text after bad image disappears", 
"<p data-parsoid='{\"dsr\":[0,32,0,0]}'>Foo bar\n<span 
class=\"mw-default-size\" typeof=\"mw:Error mw:Image\" 
data-parsoid='{\"optList\":[],\"dsr\":[8,24,null,null]}' 
data-mw='{\"errors\":[{\"key\":\"missing-image\",\"message\":\"This image does 
not exist.\"}]}'><a href=\"./File:Bad.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Bad.jpg\"},\"sa\":{}}'><img 
resource=\"./File:Bad.jpg\" src=\"./Special:FilePath/Bad.jpg\" height=\"220\" 
width=\"220\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Bad.jpg\",\"height\":\"220\",\"width\":\"220\"},\"sa\":{\"resource\":\"File:Bad.jpg\"}}'/></a></span>\nBar
 foo</p>\n");
@@ -580,6 +589,11 @@
 add("html2html", "Empty <p> tag in TOC, removed by Sanitizer (T92892)", 
"\n<div id=\"toc\" class=\"toc\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[1,151,26,6]}'>\n<div id=\"toctitle\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[28,69,19,6]}'>\n<h2 id=\"Contents\" 
data-parsoid='{\"dsr\":[48,62,2,2]}'> Contents </h2>\n</div>\n\n<ul 
data-parsoid='{\"dsr\":[71,143,0,0]}'><li 
data-parsoid='{\"dsr\":[71,143,1,0]}'> <a rel=\"mw:WikiLink\" 
href=\"./Main_Page#x\" 
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#x\"},\"sa\":{\"href\":\"#x\"},\"dsr\":[73,143,5,2]}'><span
 class=\"tocnumber\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[78,110,24,7]}'>1</span> <span 
class=\"toctext\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[111,141,22,7]}'>x</span></a></li></ul>\n\n</div>\n\n<h2
 id=\"x\" data-parsoid='{\"dsr\":[153,160,2,2]}'> x </h2>\n");
 add("html2html", "nowiki inside link inside heading (bug 18295)", "<h2 
id=\"xyz\" data-parsoid='{\"dsr\":[0,22,2,2]}'> <a rel=\"mw:WikiLink\" 
href=\"./Wiki/Foo\" title=\"Wiki/Foo\" 
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Wiki/Foo\"},\"sa\":{\"href\":\"wiki/Foo\"},\"dsr\":[3,19,11,2]}'>xyz</a>
 </h2>\n");
 add("html2html", "new support for bdi element (bug 31817)", "<p 
data-parsoid='{\"dsr\":[0,122,0,0]}'>ולדימיר לנין (ברוסית: <bdi lang=\"ru\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[22,57,15,6]}'>Владимир Ленин</bdi>, 24 
באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>\n");
+add("html2html", "Gallery override link with WikiLink (bug 34852)", "<p 
data-parsoid='{\"dsr\":[0,4,0,0]}'>\t\t* </p><div style=\"width: 155px\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[4,239,26,6]}'> \t\t\t<div 
class=\"thumb\" style=\"width: 150px;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[34,182,41,6]}'><div 
style=\"margin:68px auto;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[75,176,31,6]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\"; 
alt=\"120px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[106,170,null,null]}'/></div></div> \t\t\t<div 
class=\"gallerytext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[186,230,25,6]}'> 
caption  \t\t\t</div> \t\t</div>\n");
+add("html2html", "Gallery override link with absolute external link (bug 
34852)", "<p data-parsoid='{\"dsr\":[0,4,0,0]}'>\t\t* </p><div style=\"width: 
155px\" data-parsoid='{\"stx\":\"html\",\"dsr\":[4,239,26,6]}'> \t\t\t<div 
class=\"thumb\" style=\"width: 150px;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[34,182,41,6]}'><div 
style=\"margin:68px auto;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[75,176,31,6]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\"; 
alt=\"120px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[106,170,null,null]}'/></div></div> \t\t\t<div 
class=\"gallerytext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[186,230,25,6]}'> 
caption  \t\t\t</div> \t\t</div>\n");
+add("html2html", "Gallery override link with absolute external link with 
LanguageConverter", "<p data-parsoid='{\"dsr\":[0,4,0,0]}'>\t\t* </p><div 
style=\"width: 155px\" data-parsoid='{\"stx\":\"html\",\"dsr\":[4,239,26,6]}'> 
\t\t\t<div class=\"thumb\" style=\"width: 150px;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[34,182,41,6]}'><div 
style=\"margin:68px auto;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[75,176,31,6]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\"; 
alt=\"120px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[106,170,null,null]}'/></div></div> \t\t\t<div 
class=\"gallerytext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[186,230,25,6]}'> 
caption  \t\t\t</div> \t\t</div>\n");
+add("html2html", "Gallery override link with malicious javascript (bug 
34852)", "<p data-parsoid='{\"dsr\":[0,4,0,0]}'>\t\t* </p><div style=\"width: 
155px\" data-parsoid='{\"stx\":\"html\",\"dsr\":[4,239,26,6]}'> \t\t\t<div 
class=\"thumb\" style=\"width: 150px;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[34,182,41,6]}'><div 
style=\"margin:68px auto;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[75,176,31,6]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\"; 
alt=\"120px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[106,170,null,null]}'/></div></div> \t\t\t<div 
class=\"gallerytext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[186,230,25,6]}'> 
caption  \t\t\t</div> \t\t</div>\n");
+add("html2html", "Gallery with invalid title as link (bug 43964)", "<p 
data-parsoid='{\"dsr\":[0,4,0,0]}'>\t\t* </p><div style=\"width: 155px\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[4,229,26,6]}'> \t\t\t<div 
class=\"thumb\" style=\"width: 150px;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[34,182,41,6]}'><div 
style=\"margin:68px auto;\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[75,176,31,6]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg\"; 
alt=\"120px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[106,170,null,null]}'/></div></div> \t\t\t<div 
class=\"gallerytext\" 
data-parsoid='{\"stx\":\"html\",\"dsr\":[186,220,25,6]}'>\t\t\t</div> 
\t\t</div>\n");
 add("html2html", "Ref: 8. transclusion wikitext has lower precedence", "<p 
data-parsoid='{\"dsr\":[0,64,0,0]}'>A <span about=\"#mwt2\" class=\"mw-ref\" 
id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" 
data-parsoid='{\"dsr\":[2,41,5,6]}' 
data-mw='{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}'><a
 href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\"><span 
class=\"mw-reflink-text\">[1]</span></a></span><span typeof=\"mw:Nowiki\" 
data-parsoid='{\"dsr\":[41,64,8,9]}'> B C}}</span></p>\n<ol 
class=\"mw-references\" typeof=\"mw:Extension/references\" about=\"#mwt4\" 
data-parsoid='{\"dsr\":[65,79,2,2]}' 
data-mw='{\"name\":\"references\",\"attrs\":{}}'><li about=\"#cite_note-1\" 
id=\"cite_note-1\"><a href=\"./Main_Page#cite_ref-1\" 
rel=\"mw:referencedBy\"><span class=\"mw-linkback-text\">↑ </span></a> <span 
id=\"mw-reference-text-cite_note-1\" class=\"mw-reference-text\" 
data-parsoid=\"{}\">foo {{echo|</span></li></ol>");
 add("html2html", "References: 9. Generate missing references list at the end", 
"<p data-parsoid='{\"dsr\":[0,52,0,0]}'>A <span about=\"#mwt3\" 
class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" 
typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[2,16,5,6]}' 
data-mw='{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}'><a
 href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\"><span 
class=\"mw-reflink-text\">[1]</span></a></span> B <span about=\"#mwt4\" 
class=\"mw-ref\" id=\"cite_ref-2\" rel=\"dc:references\" 
typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[19,52,24,6]}' 
data-mw='{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-2\"},\"attrs\":{\"group\":\"inexistent\"}}'><a
 href=\"./Main_Page#cite_note-2\" style=\"counter-reset: mw-Ref 1;\" 
data-mw-group=\"inexistent\"><span class=\"mw-reflink-text\">[inexistent 
1]</span></a></span></p>\n<ol class=\"mw-references\" 
typeof=\"mw:Extension/references\" about=\"#mwt6\" 
data-parsoid='{\"dsr\":[53,67,2,2]}' 
data-mw='{\"name\":\"references\",\"attrs\":{}}'><li about=\"#cite_note-1\" 
id=\"cite_note-1\"><a href=\"./Main_Page#cite_ref-1\" 
rel=\"mw:referencedBy\"><span class=\"mw-linkback-text\">↑ </span></a> <span 
id=\"mw-reference-text-cite_note-1\" class=\"mw-reference-text\" 
data-parsoid=\"{}\">foo</span></li></ol>\n<ol class=\"mw-references\" 
typeof=\"mw:Extension/references\" about=\"#mwt8\" data-mw-group=\"inexistent\" 
data-parsoid='{\"group\":\"inexistent\",\"dsr\":[68,101,2,2]}' 
data-mw='{\"name\":\"references\",\"attrs\":{\"group\":\"inexistent\"}}'><li 
about=\"#cite_note-2\" id=\"cite_note-2\"><a href=\"./Main_Page#cite_ref-2\" 
data-mw-group=\"inexistent\" rel=\"mw:referencedBy\"><span 
class=\"mw-linkback-text\">↑ </span></a> <span 
id=\"mw-reference-text-cite_note-2\" class=\"mw-reference-text\" 
data-parsoid=\"{}\">bar</span></li></ol>");
 add("html2html", "Empty LI and TR nodes should not be stripped from top-level 
content", "<ul data-parsoid='{\"dsr\":[0,9,0,0]}'><li 
data-parsoid='{\"dsr\":[0,3,1,0]}'> a</li>\n<li 
data-parsoid='{\"dsr\":[4,5,1,0]}'></li>\n<li 
data-parsoid='{\"dsr\":[6,9,1,0]}'> b</li></ul>\n\n<table 
data-parsoid='{\"dsr\":[11,24,2,2]}'>\n<tbody 
data-parsoid='{\"dsr\":[14,22,0,0]}'><tr 
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[14,21,2,0]}'>\n<td
 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[17,21,1,0]}'>foo</td></tr>\n</tbody></table>\n");
@@ -1158,9 +1172,11 @@
 add("html2wt", "Do not convert roman numbers to language variants", "Фридрих 
IV је цар.\n");
 add("html2wt", "Don't convert raw rule \"-{R|=&gt;}-\" to \"=>\"", "=>\n");
 add("html2wt", "Don't break link parsing if language converter markup is in 
the caption.", "[[wiki/Main Page|main page]]\n");
-add("html2wt", "Don't break image parsing if language converter markup is in 
the caption.", "http://example.com/images/3/3a/Foobar.jpg\n";);
+add("html2wt", "T146305: Don't break image parsing if language converter 
markup is in the caption.", "[[Датотека:Foobar.jpg|thumb|<span></span>]]\n");
+add("html2wt", "T146305: Don't break image parsing if nested language 
converter markup is in the caption.", 
"[[File:Foobar.jpg|thumb|<span></span>]]\n");
+add("html2wt", "Don't break gallery if language converter markup is inside.", 
"\t\t* <div style=\"width: 155px\"> \t\t\t<div class=\"thumb\" style=\"width: 
150px;\"><div style=\"margin:68px 
auto;\">http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg</div></div>
 \t\t\t<div class=\"gallerytext\"> 
http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg  \t\t\t</div> 
\t\t</div>\n\t\t* <div style=\"width: 155px\"> \t\t\t<div class=\"thumb\" 
style=\"width: 150px;\"><div style=\"margin:68px 
auto;\">http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg</div></div>
 \t\t\t<div class=\"gallerytext\"> This is a test template  \t\t\t</div> 
\t\t</div>\n");
 add("html2wt", "Don't break list handling if language converter markup is in 
the item.", "; AAA\n");
-add("html2wt", "Don't break table handling if language converter markup is in 
the cell.", "{|\n| B\n|}\n");
+add("html2wt", "T153140: Don't break table handling if language converter 
markup is in the cell.", "{|\n| B\n|}\n");
 add("html2wt", "Bug 529: Uncovered bullet", "* Foo \n* Bar\n");
 add("html2wt", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy", "******* Foo \n* Bar\n");
 add("html2wt", "Bug 529: Uncovered table already at line-start", "x\n\n{|\n| 1 
\n| 2\n|-\n| 3 \n| 4\n|}\ny\n");
@@ -1222,6 +1238,11 @@
 add("html2wt", "nowiki inside link inside heading (bug 18295)", "== 
[[wiki/Foo|xyz]] ==\n");
 add("html2wt", "new support for bdi element (bug 31817)", "ולדימיר לנין 
(ברוסית: <bdi lang=\"ru\">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) 
הוא מנהיג פוליטי קומוניסטי רוסי.\n");
 add("html2wt", "Ignore pipe between table row attributes", "{|\n| quux\n|- 
id=\"foo\" style=\"color: red\"\n| bar\n|}\n");
+add("html2wt", "Gallery override link with WikiLink (bug 34852)", "\t\t* <div 
style=\"width: 155px\"> \t\t\t<div class=\"thumb\" style=\"width: 150px;\"><div 
style=\"margin:68px 
auto;\">http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg</div></div>
 \t\t\t<div class=\"gallerytext\"> caption  \t\t\t</div> \t\t</div>\n");
+add("html2wt", "Gallery override link with absolute external link (bug 
34852)", "\t\t* <div style=\"width: 155px\"> \t\t\t<div class=\"thumb\" 
style=\"width: 150px;\"><div style=\"margin:68px 
auto;\">http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg</div></div>
 \t\t\t<div class=\"gallerytext\"> caption  \t\t\t</div> \t\t</div>\n");
+add("html2wt", "Gallery override link with absolute external link with 
LanguageConverter", "\t\t* <div style=\"width: 155px\"> \t\t\t<div 
class=\"thumb\" style=\"width: 150px;\"><div style=\"margin:68px 
auto;\">http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg</div></div>
 \t\t\t<div class=\"gallerytext\"> caption  \t\t\t</div> \t\t</div>\n");
+add("html2wt", "Gallery override link with malicious javascript (bug 34852)", 
"\t\t* <div style=\"width: 155px\"> \t\t\t<div class=\"thumb\" style=\"width: 
150px;\"><div style=\"margin:68px 
auto;\">http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg</div></div>
 \t\t\t<div class=\"gallerytext\"> caption  \t\t\t</div> \t\t</div>\n");
+add("html2wt", "Gallery with invalid title as link (bug 43964)", "\t\t* <div 
style=\"width: 155px\"> \t\t\t<div class=\"thumb\" style=\"width: 150px;\"><div 
style=\"margin:68px 
auto;\">http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg</div></div>
 \t\t\t<div class=\"gallerytext\">\t\t\t</div> \t\t</div>\n");
 add("html2wt", "Language parser function", "العربية\n");
 add("html2wt", "Padleft and padright as substr", "abc\nabc\n");
 add("html2wt", "Special parser function", 
"Special:Random\nSpecial:Badtitle\nSpecial:Foobar\n");
@@ -1983,17 +2004,14 @@
 add("selser", "Don't fall for the self-closing div [2]", 
"03k36yoyy20jatt9<div>hello world</div/>");
 add("selser", "Don't fall for the self-closing div [[2]]", 
"<div>3554xqvubx83erk9hello world</div/>");
 add("selser", "Parsing of overlapping (improperly nested) inline html tags 
[2]", "y9cin9njblr6n7b9\n\n<span><s>x</span></s>");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [2]", "ixer2na9oirudi\n{|\n|-\n| -{R|B}-\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[3,[1,4]]]", "{|\n|- data-foobar=\"lxrh34k2mmoq1tt9\"\n| 
-{R|B}-<!--czk30pw9nitl0udi-->\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[3,[2,3]]]", "{|<!--kvgh4eibaoiggb9-->\n|-\n| -{R|B}-\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[4,2]]", "{|<!--g1hlzg5fl3hrrudi--><!--x4cqrou87inyu8fr-->\n|-\n| 
-{R|B}-\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[0,[[0,[3]],2]]]", "{|\n|-\n| -{R|<!--lhm6u051gyv0wwmi-->\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [1]", "{| data-foobar=\"ihw5lexd32uzncdi\"\n|-\n| -{R|B}-\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[4,[[4,0],0]]]", "{|<!--nuhfaguqghc9pb9-->\n|-\n|9qyto9ifqjsxxbt9\n| 
-{R|B}-\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[0,2]]", "{|\n<!--11c9cgnqpuys0pb9-->|-\n| -{R|B}-\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[3,1]]", "{|\n|-\n| -{R|B}-\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[3,[1,3]]]", "{|\n|- data-foobar=\"62vnpmgm6rzlg14i\"\n| 
-{R|B}-\n|}");
-add("selser", "Don't break table handling if language converter markup is in 
the cell. [[0,1]]", "{|\n|-\n| -{R|B}-\n|}");
+add("selser", "T153140: Don't break table handling if language converter 
markup is in the cell. [2]", "tusqmt2te5t57b9\n{|\n|-\n| -{R|B}-\n|}");
+add("selser", "T153140: Don't break table handling if language converter 
markup is in the cell. [[0,[1,0]]]", "{|\n|- 
data-foobar=\"7nu7ogj23evu0udi\"\n| -{R|B}-\n|}");
+add("selser", "T153140: Don't break table handling if language converter 
markup is in the cell. [[3,1]]", "{|\n|-\n| -{R|B}-\n|}");
+add("selser", "T153140: Don't break table handling if language converter 
markup is in the cell. [1]", "{| data-foobar=\"zqlxp0k9vmvuc8fr\"\n|-\n| 
-{R|B}-\n|}");
+add("selser", "T153140: Don't break table handling if language converter 
markup is in the cell. [[4,2]]", 
"{|<!--zupml16xlygmn29--><!--1434atfefr8jjor-->\n|-\n| -{R|B}-\n|}");
+add("selser", "T153140: Don't break table handling if language converter 
markup is in the cell. [[0,[1,2]]]", "{|\n|- 
data-foobar=\"tmorjabrm80hehfr\"\n| -{R|B}-<!--zqgvb957pmdt2o6r-->\n|}");
+add("selser", "T153140: Don't break table handling if language converter 
markup is in the cell. [[0,[[0,2],4]]]", "{|\n|-\n|7e0si0fnfoe0zfr\n| 
-{R|B}-<!--g8if4czfkgj8m2t9-->\n|}");
+add("selser", "T153140: Don't break table handling if language converter 
markup is in the cell. [[4,1]]", "{|<!--dsri4f0bxf1aif6r-->\n|-\n| 
-{R|B}-\n|}");
 add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[1,0]]", "******* Foo {{bullet}}");
 add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [[2,0]]", "* wzen8urjy55qaor\n******* Foo {{bullet}}");
 add("selser", "Bug 529: Uncovered bullet leaving empty list, normally removed 
by tidy [1]", "******* Foo {{bullet}}");
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 67abba0..a0369f9 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -529,6 +529,22 @@
 !! end
 
 !! test
+Heading with line break in nowiki
+!! options
+parsoid=wt2html
+!! wikitext
+== A <nowiki>B
+C</nowiki> ==
+!! html
+<h2><span class="mw-headline" id="A_B.0AC">A B
+C</span><span class="mw-editsection"><span 
class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit 
section: A B&#10;C">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
+
+!! html/parsoid
+<h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
+C</span> </h2>
+!! end
+
+!! test
 Parsing an URL
 !! wikitext
 http://fr.wikipedia.org/wiki/🍺
@@ -14158,6 +14174,19 @@
 !! end
 
 !! test
+Escape HTML special chars in image alt text with LanguageConverter
+!! options
+language=zh
+!! wikitext
+[[File:Foobar.jpg|& < > "]]
+!! html/php
+<p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; 
&quot;"><img alt="&amp; &lt; &gt; &quot;" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" /></a>
+</p>
+!! html/parsoid
+<p><span class="mw-default-size" typeof="mw:Image" 
data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' 
data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" 
data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
data-file-width="1941" data-file-height="220" data-file-type="bitmap" 
height="220" width="1941" 
data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
+!! end
+
+!! test
 Entities in file name and attributes
 !! wikitext
 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 
solution|[[7%25 solution]]]]
@@ -20609,16 +20638,70 @@
 </p>
 !! end
 
-# FIXME: This test is currently broken in the PHP parser (bug 52661)
 !! test
-Don't break image parsing if language converter markup is in the caption.
+T146304: Don't break template parsing if language converter markup is in the 
parameter.
+!! options
+language=sr variant=sr-ec
+!! wikitext
+{{echo|-{R|foo}-}}
+!! html/php
+<p>foo
+</p>
+!! end
+
+!! test
+T146305: Don't break image parsing if language converter markup is in the 
caption.
 !! options
 language=sr
 !! wikitext
-[[File:Foobar.jpg|-{R|caption}-]]
+[[File:Foobar.jpg|thumb|-{R|caption:}-]]
+!! html/php
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" 
class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg"; 
width="180" height="20" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a 
href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" 
class="internal" title="Повећај"></a></div>caption:</div></div></div>
+
 !! html/parsoid
-<p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img 
alt="caption" src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" 
height="220" /></a>
+<figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="./Датотека:Foobar.jpg"><img resource="./Датотека:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" 
data-file-width="1941" data-file-height="220" data-file-type="bitmap" 
height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" 
data-mw='{"disabled":true,"show":true,"text":"caption:"}'></span></figcaption></figure>
+!! end
+
+!! test
+T146305: Don't break image parsing if nested language converter markup is in 
the caption.
+!! options
+language=zh variant=zh-cn
+!! wikitext
+[[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: 
-{zh-hans|WEBLOG}-)}-]]
+!! html/php
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg"; 
width="180" height="20" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="放大"></a></div>blog (hk: WEBJOURNAL, tw: 
WEBLOG)</div></div></div>
+
+!! html/parsoid
+<figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" 
data-file-width="1941" data-file-height="220" data-file-type="bitmap" 
height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" 
data-mw='{"bidir":[{"l":"zh-cn","t":"blog (hk: &lt;span 
typeof=\"mw:LanguageVariant\" 
data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[42,64,null,2]}&#39; 
data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBJOURNAL\"}&#39;>&lt;/span>,
 tw: &lt;span typeof=\"mw:LanguageVariant\" 
data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[70,88,null,2]}&#39; 
data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBLOG\"}&#39;>&lt;/span>)"}],"show":true}'></span></figcaption></figure>
+!! end
+
+!! test
+Don't break gallery if language converter markup is inside.
+!! options
+language=zh
+!! wikitext
+<gallery>
+File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
+File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
+</gallery>
+!! html
+<ul class="gallery mw-gallery-traditional">
+               <li class="gallerybox" style="width: 155px"><div style="width: 
155px">
+                       <div class="thumb" style="width: 150px;"><div 
style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img 
alt="bat" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg"; 
width="120" height="14" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" 
/></a></div></div>
+                       <div class="gallerytext">
+<p><a href="/wiki/File:Foobar.jpg" class="image" title="bar"><img alt="foo" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg"; 
width="20" height="2" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
 </p>
+                       </div>
+               </div></li>
+               <li class="gallerybox" style="width: 155px"><div style="width: 
155px">
+                       <div class="thumb" style="width: 150px;"><div 
style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img 
alt="galleryalt" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg"; 
width="120" height="14" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" 
/></a></div></div>
+                       <div class="gallerytext">
+<p>This is a test template
+</p>
+                       </div>
+               </div></li>
+</ul>
+
 !! end
 
 # FIXME: This test is currently broken in the PHP parser (bug 52661)
@@ -20636,9 +20719,8 @@
 </dt></dl>
 !! end
 
-# FIXME: This test is currently broken in the PHP parser (bug 52661)
 !! test
-Don't break table handling if language converter markup is in the cell.
+T153140: Don't break table handling if language converter markup is in the 
cell.
 !! options
 language=sr variant=sr-ec
 !! wikitext
@@ -20650,7 +20732,7 @@
 <table>
 
 <tr>
-<td>Б}-
+<td> B
 </td></tr></table>
 
 !! html/parsoid
@@ -22218,7 +22300,102 @@
 
 !! end
 
+!!test
+Gallery override link with WikiLink (bug 34852)
+!! wikitext
+<gallery>
+File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
+</gallery>
+!! html
+<ul class="gallery mw-gallery-traditional">
+               <li class="gallerybox" style="width: 155px"><div style="width: 
155px">
+                       <div class="thumb" style="width: 150px;"><div 
style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg"; 
width="120" height="14" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" 
/></a></div></div>
+                       <div class="gallerytext">
+<p>caption
+</p>
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
+!!test
+Gallery override link with absolute external link (bug 34852)
+!! wikitext
+<gallery>
+File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
+</gallery>
+!! html
+<ul class="gallery mw-gallery-traditional">
+               <li class="gallerybox" style="width: 155px"><div style="width: 
155px">
+                       <div class="thumb" style="width: 150px;"><div 
style="margin:68px auto;"><a href="http://www.example.org";><img 
alt="galleryalt" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg"; 
width="120" height="14" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" 
/></a></div></div>
+                       <div class="gallerytext">
+<p>caption
+</p>
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
 !! test
+Gallery override link with absolute external link with LanguageConverter
+!! options
+language=zh
+!! input
+<gallery>
+File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
+</gallery>
+!! result
+<ul class="gallery mw-gallery-traditional">
+               <li class="gallerybox" style="width: 155px"><div style="width: 
155px">
+                       <div class="thumb" style="width: 150px;"><div 
style="margin:68px auto;"><a href="http://www.example.org";><img 
alt="galleryalt" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg"; 
width="120" height="14" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" 
/></a></div></div>
+                       <div class="gallerytext">
+<p>caption
+</p>
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
+!!test
+Gallery override link with malicious javascript (bug 34852)
+!! wikitext
+<gallery>
+File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious 
javascript code!');
+</gallery>
+!! html
+<ul class="gallery mw-gallery-traditional">
+               <li class="gallerybox" style="width: 155px"><div style="width: 
155px">
+                       <div class="thumb" style="width: 150px;"><div 
style="margin:68px auto;"><a 
href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img 
alt="galleryalt" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg"; 
width="120" height="14" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" 
/></a></div></div>
+                       <div class="gallerytext">
+<p>caption
+</p>
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
+!!test
+Gallery with invalid title as link (bug 43964)
+!! wikitext
+<gallery>
+File:foobar.jpg|link=<
+</gallery>
+!! html
+<ul class="gallery mw-gallery-traditional">
+               <li class="gallerybox" style="width: 155px"><div style="width: 
155px">
+                       <div class="thumb" style="width: 150px;"><div 
style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img 
alt="Foobar.jpg" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg"; 
width="120" height="14" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" 
/></a></div></div>
+                       <div class="gallerytext">
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
+!!test
 Language parser function
 !! wikitext
 {{#language:ar}}
diff --git a/tools/fetch-parserTests.txt.js b/tools/fetch-parserTests.txt.js
index ebca303..1b14d35 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 = "e83c0ae1b38a89ef8f9451402828e036ec1a9dde";
+var expectedSHA1 = "b9333ebe17f8d408f9c103077950226b0164fd0d";
 // git log --pretty=oneline -1 tests/parser/parserTests.txt
-var latestCommit = "caebba387a00802a6c8fdc0f53fec3cbab244be0";
+var latestCommit = "12846c08cb7f721011952da0aebb95657d7d030c";
 
 var fs = require('fs');
 var path = require('path');

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f24d9d55fa23d68f95ed66c26143b8bf44b1832
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

Reply via email to