Merge "Drop zh-tw message "saveprefs""
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
index 9cada85..c8c63f3 100644 (file)
@@ -5711,7 +5711,7 @@ Plain ''italic'''s plain
 ###
 ### Tables
 ###
-### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User's_Guide:_Using_tables
+### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
 ###
 
 # This should not produce <table></table> as <table><tr><td></td></tr></table>
@@ -6240,7 +6240,7 @@ Table cell attributes: Pipes protected by nowikis should be treated as a plain c
 | title="foo<nowiki>|</nowiki>" |bar
 | title="foo<nowiki>|</nowiki>" bar
 |}
-!! html
+!! html/php
 <table>
 <tr>
 <td title="foo">bar
@@ -6250,12 +6250,19 @@ Table cell attributes: Pipes protected by nowikis should be treated as a plain c
 <td> title="foo|" bar
 </td></tr></table>
 
+!! html/parsoid
+<table>
+<tbody><tr><td title="foo">bar</td>
+<td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
+<td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
+</tbody></table>
 !! end
 
-# The "|}" to close the table is missing from the input, so parsoid's
-# *2wt modes will fail.
+# See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
+# N.B. The "|}" to close the table is missing from the input, so parsoid's
+#      *2wt modes will fail.
 !! test
-Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
+Table security: embedded pipes
 !! options
 parsoid=wt2html,html2html
 !! wikitext
@@ -6273,12 +6280,14 @@ parsoid=wt2html,html2html
 !! html/parsoid
 <table><tbody>
 <tr>
-<td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
+<td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
 !! end
 
-# FIXME: The php output is broken.
+# FIXME: The output seems broken. Filed as T110268.
 !! test
 ! and || in td attributes should not be parsed as <th>/<td>
+!! options
+parsoid=wt2html
 !! wikitext
 {|
 | style="color: red !important;" data-contrived="put this here ||" | foo
@@ -6292,7 +6301,7 @@ parsoid=wt2html,html2html
 
 !! html/parsoid
 <table>
-<tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
+<tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
 </tbody></table>
 !! end
 
@@ -6934,6 +6943,23 @@ foo
 </tbody></table>
 !!end
 
+!! test
+Tables: Digest broken attributes on table and tr tag
+!! options
+parsoid=wt2html
+!! wikitext
+{| || |} ++
+|- || || ++ --
+|- > [
+|}
+!! html
+<table>
+<tbody>
+<tr></tr>
+<tr></tr>
+</tbody></table>
+!! end
+
 !! test
 Strip unsupported table tags
 !! options
@@ -7144,8 +7170,10 @@ Link with HTML entity in suffix / tail
 Link with 3 brackets
 !! wikitext
 [[[Main Page]]]
+Foo [[[Main Page]]]
 !! html
 <p>[[[Main Page]]]
+Foo [[[Main Page]]]
 </p>
 !! end
 
@@ -7368,7 +7396,7 @@ Link containing double-single-quotes '' (bug 4598)
 !! wikitext
 [[Lista d''e paise d''o munno]]
 !! html/php
-<p><a href="/index.php?title=Lista_d''e_paise_d''o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
+<p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
 </p>
 !! html/parsoid
 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
@@ -7405,10 +7433,10 @@ Link with double quotes in title part (literal) and alternate part (interpreted)
 
 [[''Pentecoste''|''Pentecoste'']]
 !! html/php
-<p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_&#39;&#39;Pentecoste&#39;&#39;.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
-</p><p><a href="/index.php?title=''Pentecoste''&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
-</p><p><a href="/index.php?title=''Pentecoste''&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
-</p><p><a href="/index.php?title=''Pentecoste''&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
+<p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
+</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
+</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
+</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
 </p>
 !! html/parsoid
 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
@@ -13838,9 +13866,9 @@ bar
 bar</p>
 !! end
 
-## Edge case bug in Parsoid
+## Edge case bugs in Parsoid from T93580
 !! test
-T93580: Templated <ref> inside images
+T93580: 1. Templated <ref> inside block images
 !! wikitext
 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
 
@@ -13851,6 +13879,30 @@ T93580: Templated <ref> inside images
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#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>
 !! end
 
+!! test
+T93580: 2. <ref> inside inline images
+!! wikitext
+[[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
+
+<references />
+!! html/parsoid
+<p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><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>
+
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#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>
+!! end
+
+!! test
+T93580: 3. Templated <ref> inside inline images
+!! wikitext
+[[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
+
+<references />
+!! html/parsoid
+<p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion  mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><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>
+
+<ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#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>
+!! end
+
 ###
 ### Subpages
 ###
@@ -14033,7 +14085,7 @@ Link to category
 !! wikitext
 [[:Category:MediaWiki User's Guide]]
 !! html
-<p><a href="/wiki/Category:MediaWiki_User's_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
+<p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
 </p>
 !! end
 
@@ -14044,7 +14096,7 @@ cat
 !! wikitext
 [[Category:MediaWiki User's Guide]]
 !! html
-<a href="/wiki/Category:MediaWiki_User's_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
+<a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
 !! end
 
 !! test
@@ -14063,7 +14115,7 @@ cat
 !! wikitext
 [[Category:MediaWiki User's Guide|Foo]]
 !! html
-<a href="/wiki/Category:MediaWiki_User's_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
+<a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
 !! end
 
 !! test
@@ -14073,7 +14125,7 @@ cat
 !! wikitext
 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
 !! html
-<a href="/wiki/Category:MediaWiki_User's_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
+<a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
 !! end
 
 !! test
@@ -15851,6 +15903,7 @@ MSIE 6 CSS safety test: sup/sub script (bug 55332)
 
 !! end
 
+# FIXME: Parsoid fails to sanitize this! See T58846.
 !! test
 Opera -o-link CSS
 !! wikitext
@@ -19025,7 +19078,7 @@ language=sr cat
 !! wikitext
 [[Category:МедиаWики Усер'с Гуиде]]
 !! html
-<a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User's_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
+<a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
 !! end
 
 
@@ -20673,14 +20726,18 @@ __TOC__
 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></p>
 !! end
 
+# Don't expect Parsoid to roundtrip this until the php parser comes closer to
+# html5 tag parsing.
 !! test
 Tags with parameters in TOC
+!! options
+parsoid=wt2html
 !! wikitext
 __TOC__
 == <sup class="in-h2">Hello</sup> ==
 
 == <sup class="a > b">Evilbye</sup> ==
-!! html
+!! html/php
 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
 <ul>
 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
@@ -20691,6 +20748,11 @@ __TOC__
 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></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: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 
+!! html/parsoid
+<meta property="mw:PageProp/toc" />
+<h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
+
+<h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
 !! end
 
 !! test
@@ -20981,7 +21043,7 @@ File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascri
 !! 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(&#39;malicious_javascript_code!&#39;);"><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="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>
@@ -21889,23 +21951,23 @@ Empty TR nodes should not be stripped if they have any attributes set
 !! test
 Headings: 0. Unnested
 !! options
-parsoid
+parsoid=html2wt
+!! html/parsoid
+<p>=foo=</p>
+
+<p> =foo=
+<!--cmt-->
+=foo=</p>
+
+<p>=foo<i>a</i>=</p>
 !! wikitext
 <nowiki>=foo=</nowiki>
 
-<nowiki> =foo= </nowiki>
+<nowiki> </nowiki>=foo=
 <!--cmt-->
 <nowiki>=foo=</nowiki>
 
 =foo''a''<nowiki>=</nowiki>
-!! html
-<p><span typeof="mw:Nowiki">=foo=</span></p>
-
-<p><span typeof="mw:Nowiki"> =foo= </span>
-<!--cmt-->
-<span typeof="mw:Nowiki">=foo=</span></p>
-
-<p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
 !!end
 
 # New headings and existing headings are handled differently
@@ -21962,15 +22024,26 @@ parsoid=html2wt
 !! test
 Headings: 3. Nested inside html with wikitext split by html tags
 !! options
-parsoid=html2wt,wt2wt
-!! wikitext
-= ='''bold'''<nowiki>foo=</nowiki> =
+parsoid=html2wt
 !! html/parsoid
 <h1>=<b>bold</b>foo=</h1>
+!! wikitext
+= ='''bold'''<nowiki>foo=</nowiki> =
 !!end
 
 !! test
 Headings: 4a. No escaping needed (testing just h1 and h2)
+!! options
+parsoid=html2wt
+!! html/parsoid
+<h1>=foo</h1>
+<h1>foo=</h1>
+<h1> =foo= </h1>
+<h1>=foo= bar</h1>
+<h2>=foo</h2>
+<h2>foo=</h2>
+<h1>=</h1>
+<h1><i>=</i>foo=</h1>
 !! wikitext
 = =foo =
 
@@ -21987,15 +22060,6 @@ Headings: 4a. No escaping needed (testing just h1 and h2)
 = = =
 
 = ''=''foo= =
-!! html/parsoid
-<h1>=foo</h1>
-<h1>foo=</h1>
-<h1> =foo= </h1>
-<h1>=foo= bar</h1>
-<h2>=foo</h2>
-<h2>foo=</h2>
-<h1>=</h1>
-<h1><i>=</i>foo=</h1>
 !!end
 
 !! test
@@ -22015,6 +22079,20 @@ parsoid=html2wt
 
 !! test
 Headings: 5. Empty headings
+!! options
+parsoid=html2wt
+!! html/parsoid
+<h1 data-parsoid='{}'></h1>
+
+<h2 data-parsoid='{}'></h2>
+
+<h3 data-parsoid='{}'></h3>
+
+<h4 data-parsoid='{}'></h4>
+
+<h5 data-parsoid='{}'></h5>
+
+<h6 data-parsoid='{}'></h6>
 !! wikitext
 =<nowiki/>=
 
@@ -22027,112 +22105,74 @@ Headings: 5. Empty headings
 =====<nowiki/>=====
 
 ======<nowiki/>======
-!! html/parsoid
-<h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
-
-<h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
-
-<h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
-
-<h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
-
-<h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
-
-<h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
 !!end
 
 !! test
 Headings: 6a. Heading chars in SOL context (with trailing spaces)
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p>=a=</p>
+
+<p>=a=</p> 
+
+<p>=a=</p>     
 !! wikitext
 <nowiki>=a=</nowiki>
 
 <nowiki>=a=</nowiki> 
 
 <nowiki>=a=</nowiki>   
-
-<nowiki>=a=</nowiki>   
-!! html/php
-<p>=a=
-</p><p>=a= 
-</p><p>=a=     
-</p><p>=a=     
-</p>
-!! html/parsoid
-<p><span typeof="mw:Nowiki">=a=</span></p>
-
-<p><span typeof="mw:Nowiki">=a=</span></p> 
-
-<p><span typeof="mw:Nowiki">=a=</span></p>     
-
-<p><span typeof="mw:Nowiki">=a=</span></p>     
 !!end
 
 !! test
 Headings: 6b. Heading chars in SOL context (with trailing newlines)
-!! wikitext
-<nowiki>=a=
-b</nowiki>
-
-<nowiki>=a= 
-b</nowiki>
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p>=a=
+b</p>
 
-<nowiki>=a=    
-b</nowiki>
+<p>=a= 
+b</p>
 
-<nowiki>=a=     
-b</nowiki>
-!! html/php
-<p>=a=
-b
-</p><p>=a= 
-b
-</p><p>=a=     
-b
-</p><p>=a=      
+<p>=a= 
+b</p>
+!! wikitext
+<nowiki>=a=</nowiki>
 b
-</p>
-!! html/parsoid
-<p><span typeof="mw:Nowiki">=a=
-b</span></p>
-
-<p><span typeof="mw:Nowiki">=a= 
-b</span></p>
 
-<p><span typeof="mw:Nowiki">=a=        
-b</span></p>
+<nowiki>=a=</nowiki> 
+b
 
-<p><span typeof="mw:Nowiki">=a=         
-b</span></p>
+<nowiki>=a=</nowiki>   
+b
 !!end
 
 !! test
 Headings: 6c. Heading chars in SOL context (leading newline break)
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p>a
+=b=</p>
 !! wikitext
 a
 <nowiki>=b=</nowiki>
-!! html/php
-<p>a
-=b=
-</p>
-!! html/parsoid
-<p>a
-<span typeof="mw:Nowiki">=b=</span>
 !!end
 
 !! test
 Headings: 6d. Heading chars in SOL context (with interspersed comments)
+!! options
+parsoid=html2wt
+!! html/parsoid
+<!--c0--><p>=a=</p>
+
+<!--c1--><p>=a=</p> <!--c2-->   <!--c3-->
 !! wikitext
 <!--c0--><nowiki>=a=</nowiki>
 
 <!--c1--><nowiki>=a=</nowiki> <!--c2-->         <!--c3-->
-!! html/php
-<p>=a=
-</p><p>=a=      
-</p>
-!! html/parsoid
-<!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
-
-<!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2-->   <!--c3-->
 !!end
 
 !! test
 
 !! test
 Lists: 0. Outside nests
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p>*foo</p>
+
+<p>#foo</p>
+
+<p>;Foo:bar</p>
 !! wikitext
 <nowiki>*</nowiki>foo
 
 <nowiki>#</nowiki>foo
 
-<nowiki>;Foo:</nowiki>bar
-!! html/php
-<p>*foo
-</p><p>#foo
-</p><p>;Foo:bar
-</p>
-!! html/parsoid
-<p><span typeof="mw:Nowiki">*</span>foo</p>
-
-<p><span typeof="mw:Nowiki">#</span>foo</p>
-
-<p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
+<nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
 !!end
 
 !! test
 Lists: 1. Nested inside html
+!! options
+parsoid=html2wt
+!! html/parsoid
+<ul><li>*foo</li></ul>
+<ul><li>#foo</li></ul>
+<ul><li>:foo</li></ul>
+<ul><li>;foo</li></ul>
+<ol><li>*foo</li></ol>
+<ol><li>#foo</li></ol>
+<ol><li>:foo</li></ol>
+<ol><li>;foo</li></ol>
+
 !! wikitext
 *<nowiki>*foo</nowiki>
 
@@ -22213,20 +22262,19 @@ Lists: 1. Nested inside html
 #<nowiki>:foo</nowiki>
 
 #<nowiki>;foo</nowiki>
-!! html
-<ul><li>*foo</li></ul>
-<ul><li>#foo</li></ul>
-<ul><li>:foo</li></ul>
-<ul><li>;foo</li></ul>
-<ol><li>*foo</li></ol>
-<ol><li>#foo</li></ol>
-<ol><li>:foo</li></ol>
-<ol><li>;foo</li></ol>
-
 !!end
 
 !! test
 Lists: 2. Inside definition lists
+!! options
+parsoid=html2wt
+!! html/parsoid
+<dl><dt>;foo</dt></dl>
+<dl><dt>:foo</dt></dl>
+<dl><dt>:foo</dt>
+<dd>bar</dd></dl>
+<dl><dd>:foo</dd></dl>
+
 !! wikitext
 ;<nowiki>;foo</nowiki>
 
@@ -22236,40 +22284,27 @@ Lists: 2. Inside definition lists
 :bar
 
 :<nowiki>:foo</nowiki>
-!! html
-<dl><dt>;foo</dt></dl>
-<dl><dt>:foo</dt></dl>
-<dl><dt>:foo</dt>
-<dd>bar</dd></dl>
-<dl><dd>:foo</dd></dl>
-
 !!end
 
 !! test
 Lists: 3. Only bullets at start of text should be escaped
+!! options
+parsoid=html2wt
+!! html/parsoid
+<ul><li>*foo*bar</li></ul>
+<ul><li>*foo<i>it</i>*bar</li></ul>
+
 !! wikitext
 *<nowiki>*foo*bar</nowiki>
 
 *<nowiki>*foo</nowiki>''it''*bar
-!! html
-<ul><li>*foo*bar</li></ul>
-<ul><li>*foo<i>it</i>*bar</li></ul>
-
 !!end
 
 !! test
 Lists: 4. No escapes needed
 !! options
-parsoid
-!! wikitext
-*foo*bar
-
-*''foo''*bar
-
-*[[Foo]]: bar
-
-*[[Foo]]*bar
-!! html
+parsoid=html2wt
+!! html/parsoid
 <ul>
 <li>foo*bar
 </li>
@@ -22286,10 +22321,29 @@ parsoid
 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
 </li>
 </ul>
+!! wikitext
+*foo*bar
+
+*''foo''*bar
+
+*[[Foo]]: bar
+
+*[[Foo]]*bar
 !!end
 
 !! test
 Lists: 5. No unnecessary escapes
+!! options
+parsoid=html2wt
+!! html/parsoid
+<ul><li> bar <span>[[foo]]</span></li></ul>
+<ul><li> =bar <span>[[foo]]</span></li></ul>
+<ul><li> [[bar <span>[[foo]]</span></li></ul>
+<ul><li> ]]bar <span>[[foo]]</span></li></ul>
+<ul><li> =bar <span>foo]]</span>=</li></ul>
+<ul><li> <s></s>: a</li></ul>
+<ul><li> <i>* foo</i></li></ul>
+
 !! wikitext
 * bar <span><nowiki>[[foo]]</nowiki></span>
 
@@ -22304,15 +22358,6 @@ Lists: 5. No unnecessary escapes
 * <s></s>: a
 
 * ''* foo''
-!! html
-<ul><li> bar <span>[[foo]]</span></li></ul>
-<ul><li> =bar <span>[[foo]]</span></li></ul>
-<ul><li> [[bar <span>[[foo]]</span></li></ul>
-<ul><li> ]]bar <span>[[foo]]</span></li></ul>
-<ul><li> =bar <span>foo]]</span>=</li></ul>
-<ul><li> <s></s>: a</li></ul>
-<ul><li> <i>* foo</i></li></ul>
-
 !!end
 
 !! test
@@ -22327,13 +22372,15 @@ parsoid=html2wt
 
 !! test
 Lists: 7. Escape bullets in a multi-line context
-!! wikitext
-a
-<nowiki>*</nowiki>b
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
 <p>a
 *b
 </p>
+!! wikitext
+a
+<nowiki>*</nowiki>b
 !!end
 
 !! test
@@ -22352,17 +22399,16 @@ parsoid=html2wt
 
 !! test
 HRs: 1. Single line
+!! options
+parsoid=html2wt
+!! html/parsoid
+<hr />----
+<hr />=foo=
+<hr />*foo
 !! wikitext
 ----<nowiki>----</nowiki>
 ----=foo=
 ----*foo
-!! html+tidy
-<hr />
-<p>----</p>
-<hr />
-<p>=foo=</p>
-<hr />
-<p>*foo</p>
 !! end
 
 #### --------------- Tables ---------------
@@ -22386,40 +22432,48 @@ HRs: 1. Single line
 
 !! test
 Tables: 1a. Simple example
-!! wikitext
-<nowiki>{|
-|}</nowiki>
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
 <p>{|
 |}
 </p>
+!! wikitext
+<nowiki>{|</nowiki>
+|}
 !! end
 
 !! test
 Tables: 1b. No escaping needed
-!! wikitext
-!foo
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
 <p>!foo
 </p>
+!! wikitext
+!foo
 !! end
 
 !! test
 Tables: 1c. No escaping needed
-!! wikitext
-|foo
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
 <p>|foo
 </p>
+!! wikitext
+|foo
 !! end
 
 !! test
 Tables: 1d. No escaping needed
-!! wikitext
-|}foo
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
 <p>|}foo
 </p>
+!! wikitext
+|}foo
 !! end
 
 !! test
@@ -22480,11 +22534,8 @@ parsoid=html2wt
 
 !! test
 Tables: 2c. Nested in td -- no escaping needed
-!! wikitext
-{|
-
-|foo!!bar
-|}
+!! options
+parsoid=html2wt
 !! html/*
 <table>
 
@@ -22492,15 +22543,17 @@ Tables: 2c. Nested in td -- no escaping needed
 <td>foo!!bar
 </td></tr></table>
 
-!! end
-
-!! test
-Tables: 3a. Nested in th
 !! wikitext
 {|
 
-!foo!bar
+|foo!!bar
 |}
+!! end
+
+!! test
+Tables: 3a. Nested in th
+!! options
+parsoid=html2wt
 !! html/*
 <table>
 
@@ -22508,6 +22561,11 @@ Tables: 3a. Nested in th
 <th>foo!bar
 </th></tr></table>
 
+!! wikitext
+{|
+
+!foo!bar
+|}
 !! end
 
 !! test
@@ -22616,6 +22674,19 @@ parsoid=html2wt
 
 !! test
 Tables: 4c. No escaping needed
+!! options
+parsoid=html2wt
+!! html/parsoid
+<table><tbody>
+<tr><td>foo-bar</td><td>foo+bar</td></tr>
+<tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
+<tr><td>foo
+<p>bar|baz
++bar
+-bar</p></td></tr>
+<tr><td>x
+<div>a|b</div></td>
+</tbody></table>
 !! wikitext
 {|
 |foo-bar
@@ -22656,21 +22727,18 @@ bar|baz
 <div>a|b</div>
 </td></tr></table>
 
-!! html/parsoid
-<table><tbody>
-<tr><td>foo-bar</td><td>foo+bar</td></tr>
-<tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
-<tr><td>foo
-<p>bar|baz
-+bar
--bar</p></td></tr>
-<tr><td>x
-<div>a|b</div></td>
-</tbody></table>
 !! end
 
 !! test
 Tables: 4d. No escaping needed
+!! options
+parsoid=html2wt
+!! html/parsoid
+<table>
+<tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
+<td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
+<td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
+</tbody></table>
 !! wikitext
 {|
 |[[Foo]]-bar
@@ -22687,29 +22755,6 @@ Tables: 4d. No escaping needed
 <td>-2
 </td></tr></table>
 
-!! html/parsoid
-<table>
-<tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
-<td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
-<td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
-</tbody></table>
-!! end
-
-!! test
-Tables: Digest broken attributes on table and tr tag
-!! options
-parsoid=wt2html
-!! wikitext
-{| || |} ++
-|- || || ++ --
-|- > [
-|}
-!! html
-<table>
-<tbody>
-<tr></tr>
-<tr></tr>
-</tbody></table>
 !! end
 
 !! test
@@ -22721,11 +22766,18 @@ parsoid=html2wt
 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
 !! wikitext
 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
-<nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
+|** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
 !! end
 
 !! test
 Unclosed xmlish element in table line shouldn't eat end delimiters
+!! options
+parsoid=html2wt
+!! html/parsoid
+<table>
+<tbody><tr><td> &lt;foo</td>
+<td> bar></td></tr>
+</tbody></table>
 !! wikitext
 {|
 | <foo
@@ -22739,11 +22791,6 @@ Unclosed xmlish element in table line shouldn't eat end delimiters
 <td> bar&gt;
 </td></tr></table>
 
-!! html/parsoid
-<table>
-<tbody><tr><td> &lt;foo</td>
-<td> bar></td></tr>
-</tbody></table>
 !! end
 
 #### --------------- Links ----------------
@@ -22755,6 +22802,12 @@ Unclosed xmlish element in table line shouldn't eat end delimiters
 #### --------------------------------------
 !! test
 Links 1. WikiLinks: No escapes needed
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
+<a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
+<a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
 !! wikitext
 [[Foo|Foo''boo'']]
 [[Foo|[Foobar]]]
@@ -22764,10 +22817,6 @@ Links 1. WikiLinks: No escapes needed
 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
 </p>
-!! html/parsoid
-<p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
-<a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
-<a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
 !! end
 
 !! test
@@ -22812,6 +22861,11 @@ parsoid=html2wt
 
 !! test
 Links 3. WikiLinks: No escapes needed
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
+<a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
 !! wikitext
 [[Foo|[Foobar]]
 [[Foo|foo|bar]]
@@ -22819,9 +22873,6 @@ Links 3. WikiLinks: No escapes needed
 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
 <a href="/wiki/Foo" title="Foo">foo|bar</a>
 </p>
-!! html/parsoid
-<p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
-<a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
 !! end
 
 !! test
@@ -22851,17 +22902,21 @@ parsoid=html2wt
 
 !! test
 Links 5. ExtLinks: No escapes needed
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
 !! wikitext
 [http://google.com [google]
 !! html/php
 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
 </p>
-!! html/parsoid
-<p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
 !! end
 
 !! test
 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
@@ -22895,6 +22950,8 @@ http://example.com(x<nowiki/>)
 
 !! test
 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p>x
 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
 
 !! test
 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
@@ -22942,6 +23001,8 @@ http://example.com.,;:!?\
 
 !! test
 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
@@ -22954,6 +23015,8 @@ X<nowiki/>RFC 123<nowiki/>y
 
 !! test
 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
@@ -22972,6 +23035,8 @@ RFC 123&foo
 
 !! test
 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
@@ -22984,6 +23049,8 @@ X<nowiki/>PMID 123<nowiki/>y
 
 !! test
 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
@@ -23002,6 +23069,8 @@ PMID 123&foo
 
 !! test
 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
@@ -23015,6 +23084,8 @@ a<nowiki/>ISBN 1234567890<nowiki/>b
 
 !! test
 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
+!! options
+parsoid=html2wt
 !! html/parsoid
 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
 !! wikitext
@@ -23039,13 +23110,14 @@ parsoid=html2wt
 Links 15. Link trails can't become link prefixes.
 !! options
 language=is
+parsoid=html2wt
+!! html/parsoid
+<p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
 !! wikitext
 [[Söfnuður]]-[[00]]
 !! html/php
 <p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a>
 </p>
-!! html/parsoid
-<p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
 !! end
 
 #### --------------- Quotes ---------------
@@ -23057,28 +23129,7 @@ language=is
 !! test
 1a. Quotes inside <b> and <i>
 !! options
-parsoid=html2wt,wt2wt
-!! wikitext
-''<nowiki/>'foo'''
-''<nowiki>''foo''</nowiki>''
-''<nowiki>'''foo'''</nowiki>''
-''foo''<nowiki/>'s
-'''<nowiki/>'foo''''
-'''<nowiki>''foo''</nowiki>'''
-'''<nowiki>'''foo'''</nowiki>'''
-'''foo'<nowiki/>''bar'<nowiki/>''baz'''
-'''foo'''<nowiki/>'s
-'''foo''
-''foo''<nowiki/>'
-''foo'''<nowiki/>'
-'''foo''<nowiki/>'
-''''foo'''
-'''foo'''<nowiki/>'
-''''foo'''<nowiki/>'
-''fools'<span> errand</span>''
-''<span>fool</span>'s errand''
-'<nowiki/>''foo'' bar '''baz''
-a|!*#-:;+-~[]{}b'''x''
+parsoid=html2wt
 !! html/*
 <p><i>'foo'</i>
 <i>''foo''</i>
@@ -23101,22 +23152,34 @@ a|!*#-:;+-~[]{}b'''x''
 '<i>foo</i> bar '<i>baz</i>
 a|!*#-:;+-~[]{}b'<i>x</i>
 </p>
+!! wikitext
+''<nowiki/>'foo'''
+''<nowiki>''foo''</nowiki>''
+''<nowiki>'''foo'''</nowiki>''
+''foo''<nowiki/>'s
+'''<nowiki/>'foo''''
+'''<nowiki>''foo''</nowiki>'''
+'''<nowiki>'''foo'''</nowiki>'''
+'''foo'<nowiki/>''bar'<nowiki/>''baz'''
+'''foo'''<nowiki/>'s
+'''foo''
+''foo''<nowiki/>'
+''foo'''<nowiki/>'
+'''foo''<nowiki/>'
+''''foo'''
+'''foo'''<nowiki/>'
+''''foo'''<nowiki/>'
+''fools'<span> errand</span>''
+''<span>fool</span>'s errand''
+'<nowiki/>''foo'' bar '''baz''
+a|!*#-:;+-~[]{}b'''x''
 !! end
 
 !! test
 1b. Quotes inside <b> and <i> with other tags on same line
 !! options
-parsoid=html2wt,wt2wt
-!! wikitext
-'''a'' foo ''[[bar]]''
-''a''' foo ''[[bar]]''
-''a''' foo '''{{echo|[[bar]]}}'''
-[[foo]] x'''[[bar]]''
-'''foo'' <ref>test</ref>
-'''foo'' <div title="name">test</div>
-'''foo'' and <br> bar
-<references />
-!! html
+parsoid=html2wt
+!! html/parsoid
 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
 <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
@@ -23127,45 +23190,58 @@ parsoid=html2wt,wt2wt
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
 </ol>
+!! wikitext
+'''a'' foo ''[[bar]]''
+''a''' foo ''[[bar]]''
+''a''' foo '''{{echo|[[bar]]}}'''
+[[foo]] x'''[[bar]]''
+'''foo'' <ref>test</ref>
+'''foo'' <div title="name">test</div>
+'''foo'' and <br> bar
+<references />
 !! end
 
 !! test
 2. Link fragments separated by <i> and <b> tags
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p>[[<i>foo</i>hello]]</p>
+<p>[[<b>foo</b>hello]]</p>
 !! wikitext
 [[''foo''<nowiki>hello]]</nowiki>
 
 [['''foo'''<nowiki>hello]]</nowiki>
-!! html
-<p>[[<i>foo</i>hello]]
-</p><p>[[<b>foo</b>hello]]
-</p>
 !! end
 
 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
 #        this is one of the shortcomings of this format
 !! test
 3. Link fragments inside <i> and <b>
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p><i>[[foo</i>]]</p>
+<p><b>[[foo</b>]]</p>
 !! wikitext
 ''[[foo''<nowiki>]]</nowiki>
 
 '''[[foo'''<nowiki>]]</nowiki>
-!! html
-<p><i>[[foo</i>]]
-</p><p><b>[[foo</b>]]
-</p>
 !! end
 
 !! test
 4. No escaping needed
-!! wikitext
-'<span>''bar''</span>'
-'<span>'''bar'''</span>'
-'a:b'foo
-!! html
+!! options
+options=html2wt
+!! html/parsoid
 <p>'<span><i>bar</i></span>'
 '<span><b>bar</b></span>'
 'a:b'foo
 </p>
+!! wikitext
+'<span>''bar''</span>'
+'<span>'''bar'''</span>'
+'a:b'foo
 !! end
 
 #### ----------- Paragraphs ---------------
@@ -23174,6 +23250,15 @@ parsoid=html2wt,wt2wt
 
 !! test
 1. No unnecessary escapes
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p>bar <span>[[foo]]</span>
+</p><p>=bar <span>[[foo]]</span>
+</p><p>[[bar <span>[[foo]]</span>
+</p><p>]]bar <span>[[foo]]</span>
+</p><p>=bar <span>foo]]</span>=
+</p>
 !! wikitext
 bar <span><nowiki>[[foo]]</nowiki></span>
 
@@ -23184,13 +23269,6 @@ bar <span><nowiki>[[foo]]</nowiki></span>
 ]]bar <span><nowiki>[[foo]]</nowiki></span>
 
 =bar <span>foo]]</span><nowiki>=</nowiki>
-!! html
-<p>bar <span>[[foo]]</span>
-</p><p>=bar <span>[[foo]]</span>
-</p><p>[[bar <span>[[foo]]</span>
-</p><p>]]bar <span>[[foo]]</span>
-</p><p>=bar <span>foo]]</span>=
-</p>
 !!end
 
 #### ----------------------- PRE --------------------------
@@ -23199,20 +23277,7 @@ bar <span><nowiki>[[foo]]</nowiki></span>
 !! test
 1. Leading whitespace in SOL context should be escaped
 !! options
-parsoid=html2wt,wt2wt
-!! html/php
-<p> a
-</p><p>  a
-</p><p>        a(tab)
-</p><p>        a
-  a
-</p><p>a
- b
-</p><p>a
-       b
-</p><p>a
-        b
-</p>
+parsoid=html2wt
 !! html/parsoid
 <p> a</p>
 
 
 a
         b
+!! html/php
+<p> a
+</p><p>  a
+</p><p>        a(tab)
+</p><p>        a
+  a
+</p><p>a
+ b
+</p><p>a
+       b
+</p><p>a
+        b
+</p>
 !! end
 
 !! test
 2. Leading whitespace in non-indent-pre contexts should not be escaped
 !! options
-parsoid
-!! wikitext
-foo <ref>''a''
- b</ref>
-<references />
-!! html
+parsoid=htm2wt
+!! html/parsoid
 <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
 <li about="#cite_note-1" id="cite_note-1"><a href="#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"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
  b</span></li>
 </ol>
+!! wikitext
+foo <ref>''a''
+ b</ref>
+<references />
 !! end
 
 !! test
 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
 !! options
-parsoid
-!! wikitext
+parsoid=html2wt
+!! html/parsoid
 <blockquote>
+<p>
  a
  <span>b</span>
- c
+ c</p>
 </blockquote>
-!! html
+!! wikitext
 <blockquote>
-<p>
  a
  <span>b</span>
- c</p>
+ c
 </blockquote>
 !! end
 
 !! test
 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
 !! options
-parsoid
-!! wikitext
- [[File:Foobar.jpg|thumb|caption]]
+options=html2wt
 !! 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>caption</figcaption></figure>
+!! wikitext
+ [[File:Foobar.jpg|thumb|caption]]
 !! end
 
 !! test
@@ -23311,15 +23389,15 @@ parsoid=html2wt
 !!test
 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
 !! options
-parsoid
-!! wikitext
- * foo
- * bar
-!! html
+parsoid=html2wt
+!! html/parsoid
 <pre>
 * foo
 * bar
 </pre>
+!! wikitext
+ * foo
+ * bar
 !! end
 
 #### --------------- Behavior Switches --------------------
@@ -23351,15 +23429,8 @@ __|__
 # We use indent-pre as an indirect way to test for sol-transparent behavior.
 !! test
 Behavior switches should be SOL-transparent
-!! wikitext
- __TOC__
-
- <!-- this one's bogus -->
- __TOO__
-
- __TOC__ foo
-
-__TOC__ bar
+!! options
+parsoid=html2wt
 !! html/parsoid
  <meta property="mw:PageProp/toc" />
 
@@ -23369,6 +23440,15 @@ __TOC__ bar
 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
 
 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
+!! wikitext
+ __TOC__
+
+ <!-- this one's bogus -->
+ __TOO__
+
+ __TOC__ foo
+
+__TOC__ bar
 !! end
 
 #### --------------- HTML tags ---------------
@@ -23380,75 +23460,85 @@ __TOC__ bar
 !! test
 1. a tags
 !! options
-parsoid
+parsoid=html2wt
+!! html/parsoid
+&lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
 !! wikitext
 <a href="http://google.com">google</a>
-!! html
-&lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
 !! end
 
 !! test
 2. other tags
-!! wikitext
-* <nowiki><div>foo</div></nowiki>
-* <nowiki><div style="color:red">foo</div></nowiki>
-* <nowiki><td></nowiki>
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
 <li> &lt;td&gt;</li></ul>
 
+!! wikitext
+* <nowiki><div>foo</div></nowiki>
+* <nowiki><div style="color:red">foo</div></nowiki>
+* <nowiki><td></nowiki>
 !! end
 
 !! test
 3. multi-line html tag
-!! wikitext
-<nowiki><div
->foo</div
-></nowiki>
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
 <p>&lt;div
 &gt;foo&lt;/div
 &gt;
 </p>
+!! wikitext
+<nowiki><div
+>foo</div
+></nowiki>
 !! end
 
 !! test
 4. extension tags
+!! options
+parsoid=html2wt
+!! html/parsoid
+<p>&lt;ref&gt;foo&lt;/ref&gt;
+</p><p>&lt;ref&gt;bar
+</p><p>baz&lt;/ref&gt;
+</p>
 !! wikitext
 <nowiki><ref>foo</ref></nowiki>
 
 <nowiki><ref>bar</nowiki>
 
 baz<nowiki></ref></nowiki>
-!! html
-<p>&lt;ref&gt;foo&lt;/ref&gt;
-</p><p>&lt;ref&gt;bar
-</p><p>baz&lt;/ref&gt;
-</p>
 !! end
 
 #### --------------- Others ---------------
 !! test
 Escaping nowikis
-!! wikitext
-&lt;nowiki&gt;foo&lt;/nowiki&gt;
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
 </p>
+!! wikitext
+&lt;nowiki&gt;foo&lt;/nowiki&gt;
 !! end
 
 ## The quote-char in the input is necessary for triggering the bug
 !! test
 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
 !! options
-parsoid=wt2wt,html2wt
+parsoid=html2wt
+!! html/parsoid
+<p>foo's bar :</p>
 !! wikitext
 foo's bar :
-!! html
-<p>foo's bar :</p>
 !! end
 
+#----------- End of wikitext escaping tests --------------
+
 !! test
 
 Tag-like HTML structures are passed through as text