Cscott has uploaded a new change for review.

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

Change subject: Sync parserTests with core.
......................................................................

Sync parserTests with core.

This matches upstream core commit 13a85541fccca12ead97c0bb393b505c201f4f59.

Upstream added tidy support to parser tests, in commit
019e8ce29d5e94597bf7f50a2bc6ba8614e2bbe9.  Parsoid had this support
added in commit 7a6df104bf41107c1b9d3e1291319f35e3fbcd06.

The commit adds the following new failures to the blacklist:

* Legit P-wrapping bugs:
  - "Block tag on one line (<div>)" (wt2html)
  - "Block tag on one line (<blockquote>)" (wt2html)
  - "Block tag on both lines (<div>)" (wt2html)
  - "Block tag on both lines (<blockquote>)" (wt2html)
  - "Multiple lines without block tags" (wt2html)
  - "Empty lines between lines with block tags" (wt2html)
  - "Empty lines between lines with block tags" (html2html)
     (This might be a subtly different bug, but the p-wrapping should
     be fixed first)
  - "Bug 15491: <ins>/<del> in blockquote (2)" (wt2html)
  - "Bug 15491: <ins>/<del> in blockquote (2)" (html2wt)
     (The above two are quirks in tidy; we may want to add a html/parsoid
     case for parsoid behavior... once we've fixed p-wrapping in general.)
  - "3a. Indent-Pre and block tags (single-line html)" (wt2html)
  - "3b. Indent-Pre and block tags (multi-line html)" (wt2html)
  - "Horizontal ruler -- Supports content following dashes on same line" 
(wt2html)
  - "Horizontal ruler -- Supports content following dashes on same line" 
(html2wt)
    (In the html2wt direction we don't recognize the potential implicit
    p-wrapping.)
  - "Templates: 2. Inside a block tag" (wt2html)
  - "Templates: P-wrapping: 1c. Templates on consecutive lines" (wt2html)
  - "Fuzz testing: URL adjacent extension (no space, dirty; pre)" (wt2html)
  - "Bug 6200: paragraphs inside blockquotes (no extra line breaks)" (wt2html)
  - "Bug 6200: paragraphs inside blockquotes (extra line break on close)" 
(wt2html)

* Related to p-wrapping, except in the inverse direction: we emit wt that
  *won't* get p-wrapped (but it needs to be):
  - "Bug 6200: paragraphs inside blockquotes (extra line break on open)" 
(html2wt)

* We don't strip empty <pre> tags, but tidy does:
  - "Empty pre; pre inside other HTML tags (bug 54946)" (wt2html)

* Expected fail, because the input is broken markup:
  (We should probably fix the test cases to exclude wt2wt)
  - "Implicit <td> after a |-" (wt2wt)
  - "<pre> tags should be recognized in an explicit <td> context, but not in an 
implicit <td> context" (wt2wt)

* Not yet sure what's going on here, I think our generated wt wouldn't
  round trip:
  - "Lists should be recognized in an implicit <td> context" (wt2wt)

* I think upstream/core added some new "Local" interwiki link support which
  Parsoid doesn't yet know about (maybe bug 61357,64167 is related):
  - "Local interwiki link" (wt2html)
  - "Local interwiki link" (html2wt)
  - "Local interwiki link" (html2html)
  - "Local interwiki link: self-link to current page" (wt2html)
  - "Local interwiki link: self-link to current page" (html2wt)
  - "Local interwiki link: prefix only (bug 64167)" (wt2html)
  - "Local interwiki link: prefix only (bug 64167)" (html2wt)
  - "Local interwiki link: prefix only (bug 64167)" (html2html)
  - "Local interwiki link: with additional interwiki prefix (bug 61357)" 
(wt2html)
  - "Local interwiki link: with additional interwiki prefix (bug 61357)" 
(html2wt)
  - "Local interwiki link: with additional interwiki prefix (bug 61357)" 
(html2html)
  - "Interlanguage link with preceding local interwiki link (bug 68085)" 
(wt2html)
  - "Interlanguage link with preceding local interwiki link (bug 68085)" 
(html2wt)
  - "Interlanguage link with preceding local interwiki link (bug 68085)" 
(html2html)
  - "Looks like an interlanguage link, but is actually a local interwiki" 
(wt2html)
  - "Looks like an interlanguage link, but is actually a local interwiki" 
(html2wt)
  - "Looks like an interlanguage link, but is actually a local interwiki" 
(html2html)

* Expected fail, we don't preserve crazy spacing in html2wt:
  - "Interlanguage link with spacing" (html2wt)

* We emit <li> tags unwrapped by <ul>:
  - "Multiple list tags generated by templates" (wt2html)

* Looks correct, we should fix the test case:
  - "Test the li-hack (The PHP parser relies on Tidy for the hack)" (wt2html)
  - "Test the li-hack (The PHP parser relies on Tidy for the hack)" (wt2wt)
    (the wt2wt case is maybe bogus)

* Need to look at this one:
  - "Unbalanced closing block tags break a list (php parser relies on Tidy to 
fix up)" (html2wt)

* Parsoid fails this test, "but it might be tricky to support properly. See bug 
68395.":
  - "Unbalanced closing non-block tags don't break a list (php parser relies on 
Tidy to fix up)" (wt2html)
  - "Unbalanced closing non-block tags don't break a list (php parser relies on 
Tidy to fix up)" (wt2wt)
  - "Unbalanced closing non-block tags don't break a list (php parser relies on 
Tidy to fix up)" (html2wt)
  - "Unbalanced closing non-block tags don't break a list (php parser relies on 
Tidy to fix up)" (html2html)
  - "List embedded in a non-block tag (Ugly Parsoid output -- worth fixing; PHP 
parser relies on Tidy)" (wt2html)
  - "List embedded in a non-block tag (Ugly Parsoid output -- worth fixing; PHP 
parser relies on Tidy)" (html2wt)
  - "List embedded in a non-block tag (Ugly Parsoid output -- worth fixing; PHP 
parser relies on Tidy)" (html2html)

* Minor whitespace issue; we should just add a html/parsoid clause:
  - "Unclosed formatting tags that straddle lists are closed and reopened (php 
parser relies on Tidy to fix up)" (wt2html)
  - "Unclosed formatting tags that straddle lists are closed and reopened (php 
parser relies on Tidy to fix up)" (html2wt)
    (html2wt won't work because the input is broken wikitext)

Change-Id: I0200fa70e028f4102e1cc8297e5b55c975a80843
---
M tests/fetch-parserTests.txt.js
M tests/parserTests.txt
2 files changed, 690 insertions(+), 99 deletions(-)


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

diff --git a/tests/fetch-parserTests.txt.js b/tests/fetch-parserTests.txt.js
index fb2cf21..d7cba54 100755
--- a/tests/fetch-parserTests.txt.js
+++ b/tests/fetch-parserTests.txt.js
@@ -11,9 +11,9 @@
 //     and update these hashes automatically.
 //
 // You can use 'sha1sum -b tests/parser/parserTests.txt' to compute this value:
-var expectedSHA1 = "1a8c7adf51a2b0386db250d6d9d35003790e195e";
+var expectedSHA1 = "e53008404851aefe6f90249ee96a64c37a663cda";
 // git log --pretty=oneline -1 tests/parser/parserTests.txt
-var latestCommit = "fb22c45886c6b63062dd45101a208294888e7ba9";
+var latestCommit = "13a85541fccca12ead97c0bb393b505c201f4f59";
 
 var fs = require('fs'),
        path = require('path'),
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 712ece1..decdc20 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -47,6 +47,12 @@
 !! endarticle
 
 !!article
+Foo
+!!text
+FOO
+!!endarticle
+
+!!article
 Template:Foo
 !!text
 FOO
@@ -400,6 +406,13 @@
 <p><a rel="nofollow" class="external free" 
href="http://fr.wikipedia.org/wiki/🍺";>http://fr.wikipedia.org/wiki/🍺</a>
 </p>
 !! end
+
+# Note that the html+tidy output removes the spaces after the <li>,
+# which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
+# This is an issue for all tests with lists.  We intentionally do
+# *not* add html+tidy clauses for these, as we don't want to
+# document/test the broken behavior.  (Parsoid matches the non-tidy
+# output in these cases.)
 
 !! test
 Simple list
@@ -757,7 +770,7 @@
 parsoid=wt2wt,html2wt
 !! wikitext
 '''''foo'''''
-!! html/*
+!! html
 <p><b><i>foo</i></b>
 </p>
 !! end
@@ -1037,7 +1050,16 @@
 !''a!!''b
 |''a||''b
 |}
-!! html
+!! html/php+tidy
+<table>
+<tr>
+<th><i>a</i></th>
+<th><i>b</i></th>
+<td><i>a</i></td>
+<td><i>b</i></td>
+</tr>
+</table>
+!! html/parsoid
 <table>
 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
 <td><i>a</i></td><td><i>b</i></td></tr>
@@ -1179,6 +1201,7 @@
 </p>
 !! end
 
+# There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
 !! test
 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
 !! wikitext
@@ -1538,6 +1561,10 @@
 a <div>foo</div>
 <p>b
 </p>
+!! html+tidy
+<p>a</p>
+<div>foo</div>
+<p>b</p>
 !! end
 
 !! test
@@ -1550,6 +1577,12 @@
 a <blockquote>foo</blockquote>
 <p>b
 </p>
+!! html+tidy
+<p>a</p>
+<blockquote>
+<p>foo</p>
+</blockquote>
+<p>b</p>
 !! end
 
 !! test
@@ -1562,6 +1595,11 @@
 a <div>foo</div>
 b <div>foo</div>
 
+!! html+tidy
+<p>a</p>
+<div>foo</div>
+<p>b</p>
+<div>foo</div>
 !! end
 
 !! test
@@ -1574,6 +1612,15 @@
 a <blockquote>foo</blockquote>
 b <blockquote>foo</blockquote>
 
+!! html+tidy
+<p>a</p>
+<blockquote>
+<p>foo</p>
+</blockquote>
+<p>b</p>
+<blockquote>
+<p>foo</p>
+</blockquote>
 !! end
 
 !! test
@@ -1592,6 +1639,13 @@
 </p>
 x <div>foo</div> z
 
+!! html+tidy
+<div>foo</div>
+<p>a</p>
+<p>b c d e</p>
+<p>x</p>
+<div>foo</div>
+<p>z</p>
 !! end
 
 !! test
@@ -1622,9 +1676,20 @@
 </p>
 <div>e</div>
 
+!! html+tidy
+<p><br /></p>
+<p>a</p>
+<p>b</p>
+<div>a</div>
+<p>b</p>
+<div>b</div>
+<p>d</p>
+<p><br /></p>
+<div>e</div>
 !! end
 
 ## PHP parser emits output which is broken
+## XXX The parsoid output doesn't match the tidy output.
 !! test
 Unclosed HTML p-tags should be handled properly
 !! wikitext
@@ -1632,6 +1697,11 @@
 a
 
 b
+!! html/php+tidy
+<div>
+<p>foo&lt;/div&gt;</p>
+<p>a</p>
+b</div>
 !! html/parsoid
 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", 
"autoInsertedEnd":true}'>foo</p></div>
 <p>a</p>
@@ -1783,6 +1853,10 @@
 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
 </blockquote>
 
+!! html+tidy
+<blockquote>
+<p>Foo</p>
+<del>bar</del> <ins>baz</ins> quux</blockquote>
 !! end
 
 !! test
@@ -1908,6 +1982,12 @@
 </pre></div>
 <pre></pre>
 
+!! html+tidy
+<p>a</p>
+<div>
+<pre>
+foo
+</pre></div>
 !! end
 
 !! test
@@ -2489,10 +2569,11 @@
  a
  | b
  | c
-!! html/parsoid
+!! html/php
 <pre>a
 | b
-| c</pre>
+| c
+</pre>
 !!end
 
 !!test
@@ -2501,6 +2582,12 @@
 a
  | b
  | c
+!! html/php
+<p>a
+</p>
+<pre>| b
+| c
+</pre>
 !! html/parsoid
 <p>a</p>
 <pre>
@@ -2521,7 +2608,19 @@
  c <blockquote> foo </blockquote>
 <pre><span> foo </span>
 </pre>
-!!end
+!! html+tidy
+<p>a</p>
+<p>foo</p>
+<p>b</p>
+<div>foo</div>
+<p>c</p>
+<blockquote>
+<p>foo</p>
+</blockquote>
+<pre>
+<span> foo </span>
+</pre>
+!! end
 
 !!test
 3b. Indent-Pre and block tags (multi-line html)
@@ -2533,6 +2632,12 @@
 </pre>
  b <div> foo </div>
 
+!! html+tidy
+<pre>
+a <span>foo</span>
+</pre>
+<p>b</p>
+<div>foo</div>
 !!end
 
 !!test
@@ -2614,6 +2719,18 @@
                </div></li>
 </ul>
 
+!! html+tidy
+<p>a</p>
+<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" /></a></div>
+</div>
+<div class="gallerytext"></div>
+</div>
+</li>
+</ul>
 !!end
 
 !! test
@@ -3383,6 +3500,9 @@
 ## The Parsoid team believes the following three test exposes a
 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
 ## wrong to close the <dl> after the <dt> containing the <ul>.)
+## It also exposes a "misfeature" in tidy, which doesn't like
+## <dl> tags with a single <dt> child; it converts the <dt> into
+## a <dd> in that case.  (Parsoid leaves the <dt> alone!)
 !! test
 Definition Lists: Mixed Lists: Test 1
 !! wikitext
@@ -3394,6 +3514,22 @@
 <li> bar</li></ul></dt></dl>
 <dl><dt> baz</dt></dl></dd></dl>
 
+!! html/php+tidy
+<dl>
+<dd>
+<dl>
+<dd>
+<ul>
+<li>foo</li>
+<li>bar</li>
+</ul>
+</dd>
+</dl>
+<dl>
+<dt>baz</dt>
+</dl>
+</dd>
+</dl>
 !! html/parsoid
 <dl>
 <dd><dl>
@@ -3521,6 +3657,7 @@
 # rules regarding dd/dt on the next two tests.  Parsoid is more
 # consistent, and recognizes the shared nesting and keeps the
 # still-open tags around until the nesting is complete.
+# (And tidy again converts <dt> to <dd> before 'bar'.)
 
 !! test
 Definition Lists: Mixed Lists: Test 11
@@ -3533,6 +3670,43 @@
 <dl><dt>boo&#160;</dt>
 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
 
+!! html/php+tidy
+<ul>
+<li>
+<ol>
+<li>
+<ul>
+<li>
+<ol>
+<li>
+<dl>
+<dt>foo&#160;</dt>
+<dd>
+<ul>
+<li>
+<dl>
+<dd>
+<dl>
+<dt>bar</dt>
+</dl>
+</dd>
+</dl>
+</li>
+</ul>
+</dd>
+</dl>
+<dl>
+<dt>boo&#160;</dt>
+<dd>baz</dd>
+</dl>
+</li>
+</ol>
+</li>
+</ul>
+</li>
+</ol>
+</li>
+</ul>
 !! html/parsoid
 <ul>
 <li>
@@ -3564,6 +3738,7 @@
 !! end
 
 
+# Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
 !! test
 Definition Lists: Weird Ones: Test 1
 !! wikitext
@@ -3572,6 +3747,39 @@
 <ul><li><ol><li><dl><dt> foo&#160;</dt>
 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses 
this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
 
+!! html/php+tidy
+<ul>
+<li>
+<ol>
+<li>
+<dl>
+<dt>foo&#160;</dt>
+<dd>
+<ul>
+<li>
+<dl>
+<dd>
+<dl>
+<dd>
+<dl>
+<dd>
+<dl>
+<dt>bar (who uses this?)</dt>
+</dl>
+</dd>
+</dl>
+</dd>
+</dl>
+</dd>
+</dl>
+</li>
+</ul>
+</dd>
+</dl>
+</li>
+</ol>
+</li>
+</ul>
 !! html/parsoid
 <ul>
 <li>
@@ -3782,6 +3990,11 @@
 [[wikipedia:Foo|Bar]]
 
 [[wikipedia:Foo|<span>Bar</span>]]
+!! html/php
+<p><a rel="nofollow" class="external autonumber" 
href="http://en.wikipedia.org/wiki/Foo";>[1]</a>
+</p><p><a href="http://en.wikipedia.org/wiki/Foo"; class="extiw" 
title="wikipedia:Foo">Bar</a>
+</p><p><a href="http://en.wikipedia.org/wiki/Foo"; class="extiw" 
title="wikipedia:Foo"><span>Bar</span></a>
+</p>
 !! html/parsoid
 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo";></a></p>
 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo";>Bar</a></p>
@@ -4367,6 +4580,8 @@
 !! html/php
 <p><a rel="nofollow" class="external text" 
href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm";><i>La muerte de 
Casagemas</i> (1901) en el sitio de <a 
href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1"
 class="new" title="Museo Picasso (París) (page does not exist)">Museo 
Picasso</a>.</a>
 </p>
+!! html/php+tidy
+<p><a rel="nofollow" class="external text" 
href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm";><i>La muerte de 
Casagemas</i> (1901) en el sitio de</a> <a 
href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1"
 class="new" title="Museo Picasso (París) (page does not exist)">Museo 
Picasso</a>.</p>
 !! html/parsoid
 <p><a rel="mw:ExtLink" 
href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm";><i>La muerte de 
Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" 
href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo 
Picasso</a><span>.</span></p>
 !! end
@@ -4899,6 +5114,13 @@
 {|
 | Foo!! ||
 |}
+!! html
+<table>
+<tr>
+<td> Foo!! </td>
+<td>
+</td></tr></table>
+
 !! html/parsoid
 <table data-parsoid='{}'>
 <tbody data-parsoid='{}'><tr 
data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td 
data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td 
data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
@@ -5279,6 +5501,14 @@
 <!--c1-->
 <!--c2-->| b
 |}
+!! html
+<table>
+<tr>
+<td>a
+</td>
+<td> b
+</td></tr></table>
+
 !! html/parsoid
 <table>
 <tbody><tr 
data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td 
data-parsoid='{"autoInsertedEnd":true}'>a</td>
@@ -5305,9 +5535,14 @@
 <td>foo</td></tr></tbody></table>
 !! end
 
+## Note that Parsoid output differs from PHP and PHP+tidy here.
+## The lack of <tr> tags in the PHP output is arguably a bug in the
+## PHP parser, which tidy then compounds by fostering the content
+## entirely out of the table.  Parsoid recognizes the table context
+## and generates <tr> and <td> wrappers as needed.  Hopefully nobody
+## depends on PHP's treatment of broken table markup!
 !! test
 Implicit <td> after a |-
-(PHP parser relies on Tidy to add the missing <td> tags)
 !! options
 parsoid=wt2html,wt2wt
 !! wikitext
@@ -5315,15 +5550,23 @@
 |-
 a
 |}
-!! html
+!! html/php
+<table>
+
+a
+</table>
+
+!! html/php+tidy
+<p>a</p>
+!! html/parsoid
 <table>
 <tr><td>a</td></tr>
 </table>
 !! end
 
+# Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
 !! test
-Pres should be recognized in an explicit <td> context, but not in an implicit 
<td> context
-(PHP parser relies on Tidy to add the missing <td> tags)
+<pre> tags should be recognized in an explicit <td> context, but not in an 
implicit <td> context
 !! options
 parsoid=wt2html,wt2wt
 !! wikitext
@@ -5334,7 +5577,28 @@
 |-
  b
 |}
-!! html
+!! html/php
+<table>
+
+<tr>
+<td>
+<pre>a
+</pre>
+</td></tr>
+ b
+</table>
+
+!! html/php+tidy
+<p>b</p>
+<table>
+<tr>
+<td>
+<pre>
+a
+</pre></td>
+</tr>
+</table>
+!! html/parsoid
 <table>
 <tbody>
 <tr><td><pre>a</pre></td></tr>
@@ -5343,9 +5607,9 @@
 </table>
 !! end
 
+# PHP + Tidy strips the list out of the table; Parsoid wraps it.
 !! test
 Lists should be recognized in an implicit <td> context
-(PHP parser relies on Tidy to add the missing <td> tags)
 !! options
 parsoid=wt2html,wt2wt
 !! wikitext
@@ -5353,7 +5617,17 @@
 |-
 *a
 |}
-!! html
+!! html/php
+<table>
+
+<ul><li>a</li></ul>
+</table>
+
+!! html/php+tidy
+<ul>
+<li>a</li>
+</ul>
+!! html/parsoid
 <table>
 <tr>
 <td><ul>
@@ -5426,6 +5700,16 @@
 ! foo || bar
 <!-- foo -->  || baz || quux
 |}
+!! html/php
+<table>
+<tr>
+<th> foo </th>
+<th> bar
+</th>
+<td> baz </td>
+<td> quux
+</td></tr></table>
+
 !! html/parsoid
 <table>
 <tbody><tr><th> foo </th><th> bar
@@ -5434,6 +5718,8 @@
 !! end
 
 
+# PHP throws away the (semi-broken) "foo" class here; Parsoid
+# preserves it.
 !!test
 Parsoid: Recover better from broken table attributes
 !!options
@@ -5443,6 +5729,14 @@
 | class="bar" |
 foo
 |}
+!!html/php+tidy
+<table>
+<tr>
+<td class="bar">
+<p>foo</p>
+</td>
+</tr>
+</table>
 !!html/parsoid
 <table class="foo">
 <tr>
@@ -6020,6 +6314,8 @@
 !! html/php
 <p><strong class="selflink">Bu&#103;462</strong> <strong 
class="selflink">Bug462</strong>
 </p>
+!! html/php+tidy
+<p><strong class="selflink">Bug462</strong> <strong 
class="selflink">Bug462</strong></p>
 !! html/parsoid
 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a 
rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
 !! end
@@ -6153,6 +6449,9 @@
 title=[[User:test/123]]
 !! wikitext
 [[#a|b]]
+!! html/php
+<p><a href="#a">b</a>
+</p>
 !! html/parsoid
 <p data-parsoid='{}'><a rel="mw:WikiLink" href="../User:Test/123#a" 
data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
 !! end
@@ -6261,8 +6560,8 @@
 
 [http://wp.org   ''foo'']
 !! html
-<p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" 
title="Foo (page does not exist)">  bar</a>
-</p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" 
class="new" title="Foo (page does not exist)">  <i>bar</i></a>
+<p><a href="/wiki/Foo" title="Foo">  bar</a>
+</p><p><a href="/wiki/Foo" title="Foo">  <i>bar</i></a>
 </p><p><a rel="nofollow" class="external text" href="http://wp.org";>foo</a>
 </p><p><a rel="nofollow" class="external text" 
href="http://wp.org";><i>foo</i></a>
 </p>
@@ -6282,6 +6581,9 @@
 Link with angle bracket after anchor
 !! wikitext
 [[Foo#<bar>]]
+!! html/php
+<p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
+</p>
 !! html/parsoid
 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" 
data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
 !! end
@@ -6317,6 +6619,11 @@
 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a"; class="extiw" 
title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a"; class="extiw" 
title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
 
+!! html+tidy
+<ul>
+<li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a"; class="extiw" 
title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
+<li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a"; class="extiw" 
title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
+</ul>
 !! end
 
 !! test
@@ -6388,6 +6695,44 @@
 <p data-parsoid='{}'><a rel="mw:ExtLink" 
href="http://en.wikipedia.org/wiki/Foo"; 
data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}'>Bar</a></p>
 !! end
 
+!! test
+Local interwiki link
+!! wikitext
+[[local:Template:Foo]]
+!! html
+<p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
+</p>
+!! end
+
+!! test
+Local interwiki link: self-link to current page
+!! options
+title=[[Main Page]]
+!! wikitext
+[[local:Main Page]]
+!! html
+<p><strong class="selflink">local:Main Page</strong>
+</p>
+!! end
+
+!! test
+Local interwiki link: prefix only (bug 64167)
+!! wikitext
+[[local:]]
+!! html
+<p><a href="/wiki/Main_Page" title="Main Page">local:</a>
+</p>
+!! end
+
+!! test
+Local interwiki link: with additional interwiki prefix (bug 61357)
+!! wikitext
+[[local:meatball:Hello]]
+!! html
+<p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello"; class="extiw" 
title="meatball:Hello">local:meatball:Hello</a>
+</p>
+!! end
+
 ###
 ### Interlanguage links
 ### Language links (so that searching for '### language' matches..)
@@ -6398,6 +6743,19 @@
 !! wikitext
 Blah blah blah
 [[zh:Chinese]]
+!! html/php
+<p>Blah blah blah
+</p>
+!! html/parsoid
+<p>Blah blah blah
+<link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
+!! end
+
+!! test
+Interlanguage link with spacing
+!! wikitext
+Blah blah blah
+[[   zh  :    Chinese     ]]
 !! html/php
 <p>Blah blah blah
 </p>
@@ -6547,6 +6905,28 @@
 [[en:Foo]]
 !! html
 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" 
data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
+!! end
+
+!! test
+Interlanguage link with preceding local interwiki link (bug 68085)
+!! wikitext
+Blah blah blah
+[[local:es:Spanish]]
+!! html
+<p>Blah blah blah
+<a href="http://es.wikipedia.org/wiki/Spanish"; class="extiw" 
title="es:Spanish">local:es:Spanish</a>
+</p>
+!! end
+
+!! test
+Looks like an interlanguage link, but is actually a local interwiki
+!! wikitext
+Blah blah blah
+[[mi:Template:Foo]]
+!! html
+<p>Blah blah blah
+<a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
+</p>
 !! end
 
 ###
@@ -6740,6 +7120,9 @@
 !! end
 
 # TODO: Fix html2html mode (bug 51055)!
+# This </br> handling was added as part of bug 50831; but it
+# differs from how PHP+tidy handles this.  We should investigate
+# this.
 !! test
 Parsoid: Broken br tag recognition
 !! options
@@ -6748,6 +7131,9 @@
 </br>
 
 <br/ >
+!! html/php+tidy
+<p>&lt;/br&gt;</p>
+<p><br /></p>
 !! html/parsoid
 <p><br></p>
 <p><br/></p>
@@ -6883,6 +7269,9 @@
 !! html
 <hr /> Foo
 
+!! html+tidy
+<hr />
+<p>Foo</p>
 !! end
 
 ###
@@ -7134,6 +7523,12 @@
 </li>
 </li>
 
+!! html+tidy
+<ul>
+<li>a</li>
+<li>b</li>
+<li>c</li>
+</ul>
 !!end
 
 !!test
@@ -7175,7 +7570,7 @@
 
 !!test
 Test the li-hack
-(Cannot test this with PHP parser since it relies on Tidy for the hack)
+(The PHP parser relies on Tidy for the hack)
 !!options
 parsoid=wt2html,wt2wt
 !! wikitext
@@ -7188,19 +7583,15 @@
 <li><li>not a li-hack
 </li>
 </ul>
-!! html
+!! html+tidy
 <ul>
-<li> foo</li>
+<li>foo</li>
 <li>li-hack</li>
-<li about="#mwt1" typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated
 li-hack"}}}}]}'>templated li-hack</li>
-<li> <!--foo--> </li>
-<li> li-hack with preceding comments</li>
+<li>templated li-hack</li>
+<li>unsupported li-hack with preceding comments</li>
 </ul>
-
 <ul>
-<li></li>
-<li>not a li-hack
-</li>
+<li>not a li-hack</li>
 </ul>
 !!end
 
@@ -7250,47 +7641,60 @@
 
 !! test
 Unbalanced closing block tags break a list
-(Parsoid-only since php parser generates broken html -- relies on Tidy to fix 
up)
+(php parser relies on Tidy to fix up)
 !! wikitext
 <div>
 *a</div><div>
 *b</div>
-!! html/parsoid
+!! html+tidy
 <div>
 <ul>
-<li>a
-</li>
-</ul></div><div>
+<li>a</li>
+</ul>
+</div>
+<div>
 <ul>
-<li>b
-</li>
-</ul></div>
+<li>b</li>
+</ul>
+</div>
 !! end
 
+# Parsoid fails this test, but it might be tricky to support properly.
+# See bug 68395.
 !! test
 Unbalanced closing non-block tags don't break a list
-(Parsoid-only since php parser generates broken html -- relies on Tidy to fix 
up)
+(php parser relies on Tidy to fix up)
 !! wikitext
 <span>
 *a</span><span>
 *b</span>
+!! html/php+tidy
+<ul>
+<li><span>a</span></li>
+<li><span>b</span></li>
+</ul>
 !! html/parsoid
-<p><span></span>
-</p>
+<span>
 <ul>
 <li>a<span></span>
 </li>
 <li>b
 </li>
 </ul>
+</span>
 !! end
 
 !! test
 Unclosed formatting tags that straddle lists are closed and reopened
-(Parsoid-only since php parser generates broken html -- relies on Tidy to fix 
up)
+(php parser relies on Tidy to fix up)
 !! wikitext
 # <s> a
 # b </s>
+!! html/php+tidy
+<ol>
+<li><s>a</s></li>
+<li><s>b</s></li>
+</ol>
 !! html/parsoid
 <ol>
 <li> <s> a </s>
@@ -7300,29 +7704,44 @@
 </ol>
 !! end
 
+# Parsoid fails this test, but it might be tricky to support properly.
+# See bug 68395.
 !!test
 List embedded in a non-block tag
-(Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies 
on Tidy)
+(Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
 !! wikitext
 <small>
 * foo
 </small>
+!! html/php+tidy
+<ul>
+<li><small>foo</small></li>
+</ul>
 !! html/parsoid
-<p><small></small></p>
 <small>
 <ul>
 <li> foo</li>
 </ul>
 </small>
-<p><small></small></p>
 !!end
 
+# This is a bug in the PHP parser + tidy combination.
+# (The </tr> tag gets parsed as text and html-escaped by PHP,
+# and then fostered out of the table by tidy.)
+# We believe the Parsoid output to be correct.
 !! test
 Table with missing opening <tr> tag
 !! options
 parsoid=wt2html,wt2wt
 !! wikitext
 <table>
+<td>foo</td>
+</tr>
+</table>
+!! html/php+tidy
+<p>&lt;/tr&gt;</p>
+<table>
+<tr>
 <td>foo</td>
 </tr>
 </table>
@@ -7782,9 +8201,11 @@
 title=[['foo & bar = baz']]
 !! wikitext
 ''{{PAGENAME}}''
-!! html
+!! html/php
 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
 </p>
+!! html+tidy
+<p><i>'foo &amp; bar = baz'</i></p>
 !! end
 
 !! test
@@ -7793,9 +8214,11 @@
 title=[[*RFC 1234 http://example.com/]]
 !! wikitext
 {{PAGENAME}}
-!! html
+!! html/php
 <p>&#42;RFC&#32;1234 http&#58;//example.com/
 </p>
+!! html+tidy
+<p>*RFC 1234 http://example.com/</p>
 !! end
 
 !! test
@@ -7815,9 +8238,11 @@
 title=[[*RFC 1234 http://example.com/]]
 !! wikitext
 {{PAGENAMEE}}
-!! html
+!! html/php
 <p>&#42;RFC_1234_http&#58;//example.com/
 </p>
+!! html+tidy
+<p>*RFC_1234_http://example.com/</p>
 !! end
 
 !! test
@@ -8329,9 +8754,16 @@
 !! wikitext
 {{paramtest|
   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
-!! html
+!! html/php
 This is a test template with parameter <div class="thumb tright"><div 
class="thumbinner" style="width:182px;"><a 
href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" 
title="File:Noimage.png">File:Noimage.png</a>  <div class="thumbcaption"><a 
href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" 
title="No link (page does not exist)">link</a> <a 
href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" 
title="No link (page does not exist)">caption</a></div></div></div>
 
+!! html+tidy
+<p>This is a test template with parameter</p>
+<div class="thumb tright">
+<div class="thumbinner" style="width:182px;"><a 
href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" 
title="File:Noimage.png">File:Noimage.png</a>
+<div class="thumbcaption"><a 
href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" 
title="No link (page does not exist)">link</a> <a 
href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" 
title="No link (page does not exist)">caption</a></div>
+</div>
+</div>
 !! end
 
 !! article
@@ -8533,8 +8965,8 @@
 
 {{{{echo|[[foo}}]]}}
 !! html
-<p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" 
title="Foo (page does not exist)">foo</a>}}
-</p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" 
class="new" title="Foo (page does not exist)">foo</a>}}
+<p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
+</p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
 </p><p>{{[[foo}}]]
 </p>
 !! end
@@ -9010,6 +9442,11 @@
 <div>Foo</div>
 <blockquote>Foo</blockquote>
 
+!! html+tidy
+<div>Foo</div>
+<blockquote>
+<p>Foo</p>
+</blockquote>
 !!end
 
 !!test
@@ -9047,7 +9484,11 @@
 </p>
 bar <div>baz</div>
 
-!!end
+!! html+tidy
+<p>Foo</p>
+<p>bar</p>
+<div>baz</div>
+!! end
 
 !!test
 Templates: P-wrapping: 1d. Template preceded by comment-only line
@@ -9114,7 +9555,7 @@
 !! wikitext
 {{echo|[[Foo|bar]]}}
 !! html
-<p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" 
title="Foo (page does not exist)">bar</a>
+<p><a href="/wiki/Foo" title="Foo">bar</a>
 </p>
 !!end
 
@@ -9123,7 +9564,7 @@
 !! wikitext
 [[{{echo|Foo}}|bar]]
 !! html
-<p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" 
title="Foo (page does not exist)">bar</a>
+<p><a href="/wiki/Foo" title="Foo">bar</a>
 </p>
 !!end
 
@@ -9142,7 +9583,7 @@
 
 [[:Foo{{echo|bar}}|bar]]
 !! html
-<p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" 
title="Foo (page does not exist)">bar</a>
+<p><a href="/wiki/Foo" title="Foo">bar</a>
 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" 
class="new" title="Foobar (page does not exist)">Foobar</a>
 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" 
class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" 
class="new" title="Foobar (page does not exist)">bar</a>
@@ -9165,7 +9606,7 @@
 !! wikitext
 [[Foo|{{echo|bar}}]]
 !! html
-<p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" 
title="Foo (page does not exist)">bar</a>
+<p><a href="/wiki/Foo" title="Foo">bar</a>
 </p>
 !!end
 
@@ -9174,7 +9615,7 @@
 !! wikitext
 {{echo|[[{{echo|Foo}}|bar]]}}
 !! html
-<p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" 
title="Foo (page does not exist)">bar</a>
+<p><a href="/wiki/Foo" title="Foo">bar</a>
 </p>
 !!end
 
@@ -9356,7 +9797,14 @@
 a
 <tr><td></td></tr></table>
 
-!!end
+!! html+tidy
+<p>a</p>
+<table>
+<tr>
+<td></td>
+</tr>
+</table>
+!! end
 
 !!test
 Templates: Wiki Tables: 1b. Fostering of entire template content
@@ -9374,7 +9822,16 @@
 </div>
 <tr><td></td></tr></table>
 
-!!end
+!! html+tidy
+<div>
+<p>foo</p>
+</div>
+<table>
+<tr>
+<td></td>
+</tr>
+</table>
+!! end
 
 !!test
 Templates: Wiki Tables: 2. Fostering of partial template content
@@ -9389,7 +9846,15 @@
 <div>b</div>
 <tr><td></td></tr></table>
 
-!!end
+!! html+tidy
+<p>a</p>
+<div>b</div>
+<table>
+<tr>
+<td></td>
+</tr>
+</table>
+!! end
 
 !!test
 Templates: Wiki Tables: 3. td-content via multiple templates
@@ -9495,7 +9960,11 @@
 !! html
 a<div>bc</div>de
 
-!!end
+!! html+tidy
+<p>a</p>
+<div>bc</div>
+<p>de</p>
+!! end
 
 !!test
 Templates: Ugly templates: 1. Navbox template parses badly leading to table 
misnesting
@@ -10406,7 +10875,7 @@
 [[Link2]]
 ]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>Caption <a 
href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" 
title="Link1 (page does not exist)">Link1</a> [[]] <a 
href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" 
title="Link2 (page does not exist)">Link2</a></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>Caption <a 
href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" 
title="Link1 (page does not exist)">Link1</a> [[]] <a 
href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" 
title="Link2 (page does not exist)">Link2</a></div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb" 
data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption
 [[Link1]]\n[[]]\n[[Link2]]\n"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" 
data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><img 
resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" 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,57,null,null]}'>Caption <a rel="mw:WikiLink" 
href="./Link1" title="Link1" 
data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
@@ -10442,7 +10911,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:139px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg"; 
width="137" height="16" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>This is a caption</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:139px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg"; 
width="137" height="16" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
 
 !! html/parsoid
 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" 
data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span 
about=\"#mwt1\" typeof=\"mw:Transclusion\" 
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;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\"
 
data-parsoid=\"{&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;dsr&amp;quot;:[24,38,null,null]}\">137px&lt;/span>"}]]}'><a
 href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="16" 
width="137"/></a><figcaption>This is a caption</figcaption></figure>
@@ -10453,7 +10922,7 @@
 !! wikitext
 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:139px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg"; 
width="137" height="16" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>This is a caption</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:139px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg"; 
width="137" height="16" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
 
 !! html/parsoid
 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" 
data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" 
typeof=\"mw:Transclusion\" 
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;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\"
 
data-parsoid=\"{&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;dsr&amp;quot;:[18,32,null,null]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span
 about=\"#mwt2\" typeof=\"mw:Transclusion\" 
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;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\"
 
data-parsoid=\"{&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;dsr&amp;quot;:[33,47,null,null]}\">137px&lt;/span>"}]]}'><a
 href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="16" 
width="137"/></a><figcaption>This is a caption</figcaption></figure>
@@ -10483,6 +10952,7 @@
 <figure class="mw-default-size mw-halign-right" typeof="mw:Image 
mw:Placeholder"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a><figcaption>Caption text</figcaption></figure>
 !! end
 
+# Parsoid's output here is broken (incorrect p-wrapping); see bug 64901.
 !! test
 Image with link tails
 !! options
@@ -10495,8 +10965,21 @@
 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
/></a>456
 </p>
 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img 
alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" 
height="220" /></a></div>456
-123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div></div></div></div>456
+123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div></div></div></div>456
 
+!! html/php+tidy
+<p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
/></a>456</p>
+<p>123</p>
+<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img 
alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" 
height="220" /></a></div>
+<p>456 123</p>
+<div class="thumb tright">
+<div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" 
class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
+<div class="thumbcaption">
+<div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" 
title="Enlarge"></a></div>
+</div>
+</div>
+</div>
+<p>456</p>
 !! html/parsoid
 <p>123<span class="mw-default-size" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a></span>456</p>
 123<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a></figure>456
@@ -10534,7 +11017,7 @@
 
 [[File:Foobar.jpg|middle|text-top|caption]]
 !! html/php
-<div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
+<div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>caption</div></div></div>
 <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" style="vertical-align: middle" /></a>
 </p>
 !! html/parsoid
@@ -10695,7 +11178,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="http://example.com/";><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>Title</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="http://example.com/";><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>Title</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="http://example.com/";><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption>Title</figcaption></figure>
@@ -10708,7 +11191,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:137px;"><a 
href="/wiki/File:Foobar.jpg"><img alt="" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>Title</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:137px;"><a 
href="/wiki/File:Foobar.jpg"><img alt="" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" 
title="Enlarge"></a></div>Title</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb" 
data-mw='{"thumb":"Thumb.png"}'><a href="File:Foobar.jpg"><img 
resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" 
height="135" width="135"/></a><figcaption>Title</figcaption></figure>
@@ -10722,7 +11205,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:137px;"><a 
href="/wiki/Main_Page" title="Main Page"><img alt="" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>Title</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:137px;"><a 
href="/wiki/Main_Page" title="Main Page"><img alt="" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" 
title="Enlarge"></a></div>Title</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb" 
data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img 
resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" 
height="135" width="135"/></a><figcaption>Title</figcaption></figure>
@@ -10736,7 +11219,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:137px;"><a 
href="http://example.com";><img alt="" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>Title</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:137px;"><a 
href="http://example.com";><img alt="" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" 
title="Enlarge"></a></div>Title</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb" 
data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com";><img 
resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" 
height="135" width="135"/></a><figcaption>Title</figcaption></figure>
@@ -10750,7 +11233,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:137px;"><img 
alt="" src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" />  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>Title</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:137px;"><img 
alt="" src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" />  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" 
title="Enlarge"></a></div>Title</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb" 
data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" 
src="//example.com/images/e/ea/Thumb.png" height="135" 
width="135"/></span><figcaption>Title</figcaption></figure>
@@ -10764,7 +11247,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:137px;"><a 
href="/wiki/Main_Page" title="Main Page"><img alt="alttext" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>Title</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:137px;"><a 
href="/wiki/Main_Page" title="Main Page"><img alt="alttext" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" 
title="Enlarge"></a></div>Title</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb" 
data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" 
resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" 
height="135" width="135"/></a><figcaption>Title</figcaption></figure>
@@ -10867,9 +11350,9 @@
 [[File:Foobar.jpg|thumb|frameless|caption]]
 [[File:Foobar.jpg|thumb|frame|caption]]
 !! 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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
-<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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
-<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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
+<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="Enlarge"></a></div>caption</div></div></div>
+<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="Enlarge"></a></div>caption</div></div></div>
+<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="Enlarge"></a></div>caption</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/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption>caption</figcaption></figure>
@@ -10929,7 +11412,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|50px]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:52px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg"; 
width="50" height="6" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:52px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg"; 
width="50" height="6" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div></div></div></div>
 
 !! html/parsoid
 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="6" width="50"/></a></figure>
@@ -10944,8 +11427,8 @@
 
 [[File:Foobar.svg|thumb|2000px]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div></div></div></div>
-<div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a 
href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" 
src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png"; 
width="2000" height="1500" class="thumbimage" 
srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 
1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" 
/></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.jpg" class="internal" 
title="Enlarge"></a></div></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a 
href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" 
src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png"; 
width="2000" height="1500" class="thumbimage" 
srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 
1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" 
/></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.svg" class="internal" 
title="Enlarge"></a></div></div></div></div>
 
 !! html/parsoid
 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="220" width="1941"/></a></figure>
@@ -11047,7 +11530,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|http://example.com]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div><a rel="nofollow" class="external free" 
href="http://example.com";>http://example.com</a></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external 
free" href="http://example.com";>http://example.com</a></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/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption><a rel="mw:ExtLink" 
href="http://example.com";>http://example.com</a></figcaption></figure>
@@ -11061,7 +11544,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div><a rel="nofollow" class="external free" 
href="http://example.com";>http://example.com</a></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external 
free" href="http://example.com";>http://example.com</a></div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption><a rel="mw:ExtLink" 
href="http://example.com";>http://example.com</a></figcaption></figure>
@@ -11073,7 +11556,7 @@
 !! wikitext
 [[File:Foobar.svg|thumb|caption]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/wiki/File:Foobar.svg" class="image"><img alt="" 
src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png"; 
width="180" height="135" class="thumbimage" 
srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 
1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" 
/></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/wiki/File:Foobar.svg" class="image"><img alt="" 
src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png"; 
width="180" height="135" class="thumbimage" 
srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 
1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" 
/></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.svg" class="internal" 
title="Enlarge"></a></div>caption</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="File:Foobar.svg"><img resource="./File:Foobar.svg" 
src="//example.com/images/f/ff/Foobar.svg" height="165" 
width="220"/></a><figcaption>caption</figcaption></figure>
@@ -11086,7 +11569,7 @@
 !! wikitext
 [[File:Foobar.svg|thumb|caption|lang=de]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" 
src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png";
 width="180" height="135" class="thumbimage" 
srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png
 1.5x, 
http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" 
/></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" 
src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png";
 width="180" height="135" class="thumbimage" 
srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png
 1.5x, 
http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" 
/></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.svg" class="internal" 
title="Enlarge"></a></div>caption</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="File:Foobar.svg"><img resource="./File:Foobar.svg" 
src="//example.com/images/f/ff/Foobar.svg" lang="de" height="165" 
width="220"/></a><figcaption>caption</figcaption></figure>
@@ -11099,7 +11582,7 @@
 !! wikitext
 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/wiki/File:Foobar.svg" class="image"><img alt="" 
src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png"; 
width="180" height="135" class="thumbimage" 
srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 
1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" 
/></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>lang=invalid.language.code</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/wiki/File:Foobar.svg" class="image"><img alt="" 
src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png"; 
width="180" height="135" class="thumbimage" 
srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 
1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" 
/></a>  <div class="thumbcaption"><div class="magnify"><a 
href="/wiki/File:Foobar.svg" class="internal" 
title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="File:Foobar.svg"><img resource="./File:Foobar.svg" 
src="//example.com/images/f/ff/Foobar.svg" height="165" 
width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
@@ -11110,7 +11593,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
 !! 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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal 
mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
+<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="Enlarge"></a></div><a 
href="/wiki/Special:BookSources/1235467890" class="internal 
mw-magiclink-isbn">ISBN 1235467890</a></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/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption><a href="Special:BookSources/1235467890" 
rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
@@ -11121,7 +11604,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|This is RFC 12354]]
 !! 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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" 
href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
+<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="Enlarge"></a></div>This is <a class="external 
mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 
12354</a></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/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" 
rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
@@ -11132,7 +11615,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|Please mailto:nob...@example.com]]
 !! 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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>Please <a rel="nofollow" class="external free" 
href="mailto:nob...@example.com";>mailto:nob...@example.com</a></div></div></div>
+<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="Enlarge"></a></div>Please <a rel="nofollow" 
class="external free" 
href="mailto:nob...@example.com";>mailto:nob...@example.com</a></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/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption>Please <a rel="mw:ExtLink" 
href="mailto:nob...@example.com";>mailto:nob...@example.com</a></figcaption></figure>
@@ -11223,7 +11706,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|This is a caption with another 
[[File:Thumb.png|image]] inside it!]]
 !! 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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" 
class="image" title="image"><img alt="image" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" /></a> 
inside it!</div></div></div>
+<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="Enlarge"></a></div>This is a caption with another <a 
href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" 
src="http://example.com/images/e/ea/Thumb.png"; width="135" height="135" /></a> 
inside it!</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/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption>This is a caption with another <span 
class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a 
href="File:Thumb.png"><img resource="./File:Thumb.png" 
src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a></span> 
inside it!</figcaption></figure>
@@ -11247,7 +11730,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb| bar]]
 !! 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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>bar</div></div></div>
+<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="Enlarge"></a></div>bar</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/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption> bar</figcaption></figure>
@@ -11266,7 +11749,7 @@
 |}
 and some more text.]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg"; 
width="200" height="23" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>This is an example image thumbnail caption with a table <table> 
<tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 
</td></tr></table> and some more text.</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg"; 
width="200" height="23" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>This is an example image thumbnail 
caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> 
Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
 
 !! html/parsoid
 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="23" width="200"/></a><figcaption>This is an example image thumbnail 
caption with a table
@@ -11283,7 +11766,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and 
[https://example.com Secure] ext links in it.]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg"; 
width="200" height="23" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>This caption has <a rel="nofollow" class="external text" 
href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" 
href="https://example.com";>Secure</a> ext links in it.</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg"; 
width="200" height="23" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" 
class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" 
class="external text" href="https://example.com";>Secure</a> ext links in 
it.</div></div></div>
 
 !! html/parsoid
 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" 
href="irc://example.net">irc</a> and <a rel="mw:ExtLink" 
href="https://example.com";>Secure</a> ext links in it.</figcaption></figure>
@@ -11325,7 +11808,7 @@
 !! wikitext
 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
 !! html/php
-<div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/Foo" title="Foo"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a 
href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
+<div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/Foo" title="Foo"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a 
href="/wiki/Archivo:Foobar.jpg" class="internal" 
title="Aumentar"></a></div>caption</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a 
href="./Foo"><img resource="./Archivo:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption>caption</figcaption></figure>
@@ -11358,9 +11841,9 @@
 
 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
 !! html/php
-<div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
-<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
-<div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>caption</div></div></div>
+<div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>caption</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>caption</div></div></div>
+<div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg"; 
width="220" height="25" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="Enlarge"></a></div>caption</div></div></div>
 
 !! html/parsoid
 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption>caption</figcaption></figure>
@@ -12725,6 +13208,8 @@
 !! html
 <p>I always thought &#233; was a cute letter.
 </p>
+!! html+tidy
+<p>I always thought é was a cute letter.</p>
 !! end
 
 !! test
@@ -12786,6 +13271,7 @@
 !! end
 
 # This was bug 41545 in the PHP parser.
+# Note that tidy doesn't handle this correctly.
 !! test
 Nesting of <kbd>
 !! wikitext
@@ -12798,6 +13284,8 @@
 # The following cases were bug 51081 in the PHP parser.
 # Note that there are some other nestable tags (b, i, etc) which are
 # not covered; see bug 51081 for discussion.
+
+# Note that tidy doesn't handle this correctly.
 !! test
 Nesting of <em>
 !! wikitext
@@ -12807,6 +13295,7 @@
 </p>
 !! end
 
+# Note that tidy doesn't handle this correctly.
 !! test
 Nesting of <strong>
 !! wikitext
@@ -12820,11 +13309,11 @@
 Nesting of <q>
 !! wikitext
 <q>X<q>Y</q>Z</q>
-!! html
-<p><q>X<q>Y</q>Z</q>
-</p>
+!! html+tidy
+<p><q>X<q>Y</q>Z</q></p>
 !! end
 
+# Note that tidy doesn't handle this correctly.
 !! test
 Nesting of <ruby>
 !! wikitext
@@ -12834,6 +13323,7 @@
 </p>
 !! end
 
+# Note that tidy doesn't handle this correctly.
 !! test
 Nesting of <bdo>
 !! wikitext
@@ -12875,6 +13365,8 @@
 !! html
 <a href="http://example.com/images/3/3a/Foobar.jpg"; class="internal" 
title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" 
onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
 
+!! html+tidy
+<p><a href="http://example.com/images/3/3a/Foobar.jpg"; class="internal" 
title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" 
onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a></p>
 !! end
 
 !! test
@@ -14026,6 +14518,17 @@
 </div>
 
 
+!! html+tidy
+<h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</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: onmouseover=">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
+<p>http://</p>
+<div id="toc" class="toc">
+<div id="toctitle">
+<h2>Contents</h2>
+</div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span 
class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
+</ul>
+</div>
 !! end
 
 !! test
@@ -14039,6 +14542,13 @@
 <tr><td></td></tr>
 </table>
 
+!! html+tidy
+<h2><span class="mw-headline" id="a">a</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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+<table style="__TOC__">
+<tr>
+<td></td>
+</tr>
+</table>
 !! end
 
 # Known to produce bogus xml (extra </td>)
@@ -14060,6 +14570,15 @@
 </tr>
 </table>
 
+!! html+tidy
+<table>
+<tr>
+<th>https://</th>
+<th></th>
+<th></th>
+<th></th>
+</tr>
+</table>
 !! end
 
 !! test
@@ -14147,7 +14666,6 @@
 
 !!test
 Fuzz testing: URL adjacent extension (with space, clean)
-!! options
 !! wikitext
 http://example.com <nowiki>junk</nowiki>
 !! html
@@ -14157,7 +14675,6 @@
 
 !!test
 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
-!! options
 !! wikitext
 http://example.com<nowiki>junk</nowiki>
 !! html
@@ -14167,12 +14684,16 @@
 
 !!test
 Fuzz testing: URL adjacent extension (no space, dirty; pre)
-!! options
 !! wikitext
 http://example.com<pre>junk</pre>
 !! html
 <a rel="nofollow" class="external free" 
href="http://example.com";>http://example.com</a><pre>junk</pre>
 
+!! html+tidy
+<p><a rel="nofollow" class="external free" 
href="http://example.com";>http://example.com</a></p>
+<pre>
+junk
+</pre>
 !!end
 
 !!test
@@ -15565,6 +16086,8 @@
 !! html/php
 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
 </p>
+!! html/php+tidy
+<p>JavaScript</p>
 !! html/parsoid
 <p><span typeof="mw:Entity">J</span><span typeof="mw:Entity">a</span><span 
typeof="mw:Entity">v</span><span typeof="mw:Entity">a</span><span 
typeof="mw:Entity">S</span><span typeof="mw:Entity">c</span><span 
typeof="mw:Entity">r</span><span typeof="mw:Entity">i</span><span 
typeof="mw:Entity">p</span><span typeof="mw:Entity">t</span></p>
 !! end
@@ -15589,6 +16112,8 @@
 !! html/php
 <p>&#xee;&#xee;
 </p>
+!! html/php+tidy
+<p>îî</p>
 !! html/parsoid
 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
 !! end
@@ -15610,6 +16135,8 @@
 !! html
 <p><a href="/wiki/Special:BookSources/9780123456" class="internal 
mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
 </p>
+!! html+tidy
+<p><a href="/wiki/Special:BookSources/9780123456" class="internal 
mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
 !! end
 
 !! test
@@ -15681,6 +16208,8 @@
 !! html
 <p><a class="external mw-magiclink-rfc" rel="nofollow" 
href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
 </p>
+!! html+tidy
+<p><a class="external mw-magiclink-rfc" rel="nofollow" 
href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
 !! end
 
 !! test
@@ -15796,7 +16325,7 @@
 !! wikitext
 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] 
URL]]
 !! 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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>An <a rel="nofollow" class="external text" 
href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx";>external</a> 
URL</div></div></div>
+<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="Enlarge"></a></div>An <a rel="nofollow" class="external 
text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx";>external</a> 
URL</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/3/3a/Foobar.jpg" height="25" 
width="220"/></a><figcaption>An <a rel="mw:ExtLink" 
href="http://test/?param1=|left|&amp;param2=|x">external</a> 
URL</figcaption></figure>
@@ -16902,6 +17431,10 @@
 <blockquote>Line one
 Line two</blockquote>
 
+!! html+tidy
+<blockquote>
+<p>Line one Line two</p>
+</blockquote>
 !! end
 
 !! test
@@ -16917,6 +17450,10 @@
 </p>
 Line two</blockquote>
 
+!! html+tidy
+<blockquote>
+<p>Line one</p>
+Line two</blockquote>
 !! end
 
 !! test
@@ -16932,6 +17469,11 @@
 </p>
 </blockquote>
 
+!! html+tidy
+<blockquote>
+<p>Line one</p>
+<p>Line two</p>
+</blockquote>
 !! end
 
 !! test
@@ -16949,6 +17491,11 @@
 </p>
 </blockquote>
 
+!! html+tidy
+<blockquote>
+<p>Line one</p>
+<p>Line two</p>
+</blockquote>
 !! end
 
 !! test
@@ -17030,7 +17577,7 @@
 !! wikitext
 [[Image:Foobar.jpg|thumb|http://x|hello]]
 !! html
-<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="Enlarge"><img 
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" 
/></a></div>hello</div></div></div>
+<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="Enlarge"></a></div>hello</div></div></div>
 
 !! end
 
@@ -17709,6 +18256,20 @@
 
 <h2><span class="mw-headline" 
id="Quote"><blockquote>Quote</blockquote></span><span 
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit 
section: Quote">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
 
+!! html+tidy
+<div id="toc" class="toc">
+<div id="toctitle">
+<h2>Contents</h2>
+</div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#Quote"><span 
class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
+</ul>
+</div>
+<h2><span class="mw-headline" id="Quote"></span></h2>
+<blockquote>
+<p><span class="mw-headline" id="Quote">Quote</span></p>
+</blockquote>
+<p><span class="mw-editsection"><span 
class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit 
section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></p>
 !! end
 
 !! test
@@ -17751,6 +18312,22 @@
 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></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: Foo Bar">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> 
<blockquote>Bar</blockquote></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: Foo Bar">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
 
+!! html+tidy
+<div id="toc" class="toc">
+<div id="toctitle">
+<h2>Contents</h2>
+</div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span 
class="tocnumber">1</span> <span class="toctext"><i>Foo</i> 
<b>Bar</b></span></a></li>
+<li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span 
class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
+</ul>
+</div>
+<h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></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: Foo Bar">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
+<h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
+<blockquote>
+<p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
+</blockquote>
+<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
 
 !! test
@@ -17933,7 +18510,7 @@
 !! wikitext
 ==[[foo|x<nowiki>y</nowiki>z]]==
 !! html
-<h2><span class="mw-headline" id="xyz"><a 
href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" 
title="Foo (page does not exist)">xyz</a></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: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+<h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" 
title="Foo">xyz</a></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: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 
 !! end
 
@@ -20142,6 +20719,13 @@
  {|
  |foo
  |}
+!! html/php
+ <div>foo</div>
+<table>
+<tr>
+<td>foo
+</td></tr></table>
+
 !! html/parsoid
  <div data-parsoid='{"stx":"html"}'>foo</div>
  <table><tbody>
@@ -20156,6 +20740,13 @@
  <!--hi-->|-
  | there
 |}
+!! html/php
+<table>
+
+<tr>
+<td> there
+</td></tr></table>
+
 !! html/parsoid
 <table data-parsoid='{}'>
  <!--hi--><tbody data-parsoid='{}'><tr 
data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0200fa70e028f4102e1cc8297e5b55c975a80843
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <canan...@wikimedia.org>

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

Reply via email to