|}
!! result
<table>
-<caption> caption
-</caption><tr><td></td></tr></table>
+<caption>caption
+</caption>
+<tr><td></td></tr>
+</table>
!! end
!! result
<table>
<tr>
-<td> 1 </td>
-<td> 2
-</td></tr>
+<td>1</td>
+<td>2</td>
+</tr>
<tr>
-<td> 3 </td>
-<td> 4
-</td></tr></table>
+<td>3</td>
+<td>4</td>
+</tr>
+</table>
!! end
<table border="1" cellpadding="2">
<caption>Multiplication table
</caption>
+<thead>
<tr>
-<th> × </th>
-<th> 1 </th>
-<th> 2 </th>
-<th> 3
-</th></tr>
+<th>×</th>
+<th>1</th>
+<th>2</th>
+<th>3</th>
+</tr></thead>
+<tbody>
<tr>
-<th> 1
-</th>
-<td> 1 </td>
-<td> 2 </td>
-<td> 3
-</td></tr>
+<th>1</th>
+<td>1</td>
+<td>2</td>
+<td>3</td>
+</tr>
<tr>
-<th> 2
-</th>
-<td> 2 </td>
-<td> 4 </td>
-<td> 6
-</td></tr>
+<th>2</th>
+<td>2</td>
+<td>4</td>
+<td>6</td>
+</tr>
<tr>
-<th> 3
-</th>
-<td> 3 </td>
-<td> 6 </td>
-<td> 9
-</td></tr>
+<th>3</th>
+<td>3</td>
+<td>6</td>
+<td>9</td>
+</tr>
<tr>
-<th> 4
-</th>
-<td> 4 </td>
-<td> 8 </td>
-<td> 12
-</td></tr>
+<th>4</th>
+<td>4</td>
+<td>8</td>
+<td>12</td>
+</tr>
<tr>
-<th> 5
-</th>
-<td> 5 </td>
-<td> 10 </td>
-<td> 15
-</td></tr></table>
+<th>5</th>
+<td>5</td>
+<td>10</td>
+<td>15</td>
+</tr></tbody>
+</table>
!! end
!! result
<table align="right" border="1">
<tr>
-<td> Cell 1, row 1
-</td>
-<td rowspan="2"> Cell 2, row 1 (and 2)
-</td>
-<td> Cell 3, row 1
-</td></tr>
+<td>Cell 1, row 1</td>
+<td rowspan="2">Cell 2, row 1 (and 2)</td>
+<td>Cell 3, row 1</td>
+</tr>
<tr>
-<td> Cell 1, row 2
-</td>
-<td> Cell 3, row 2
-</td></tr></table>
+<td>Cell 1, row 2</td>
+<td>Cell 3, row 2</td>
+</tr>
+</table>
!! end
!! result
<table border="1">
<tr>
-<td> α
-</td>
+<td>α</td>
<td>
<table bgcolor="#ABCDEF" border="2">
<tr>
-<td>nested
-</td></tr>
+<td>nested</td>
+</tr>
<tr>
-<td>table
-</td></tr></table>
-</td>
-<td>the original table again
-</td></tr></table>
+<td>table</td>
+</tr>
+</table></td>
+<td>the original table again</td>
+</tr>
+</table>
!! end
!! result
<table>
<tr>
-<td>broken
-</td></tr></table>
+<td>broken</td>
+</tr>
+</table>
+
+!! end
+
+!! test
+Heading inside table (affected by r85922)
+!! input
+{|
+|- valign="top"
+|
+=== Heading ===
+|}
+!! result
+<table>
+<tr valign="top">
+<td>
+<h3><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Heading">edit</a>]</span> <span class="mw-headline" id="Heading"> Heading </span></h3>
+</td>
+</tr>
+</table>
+
+!! end
+
+!! test
+A table with a caption with unclosed italic
+!! input
+{|
+|+ ''caption
+| Cell
+|}
+!! result
+<table>
+<caption><i>caption</i>
+</caption>
+<tr>
+<td>Cell</td>
+</tr>
+</table>
+
+!! end
+
+!! test
+A table with unclosed italic in a cell
+!! input
+{|
+| ''Cell
+|}
+!! result
+<table>
+<tr>
+<td><i>Cell</i></td>
+</tr>
+</table>
!! end
+!! test
+A table with unclosed italic in a th
+!! input
+{|
+|-
+! ''Cell
+|| Value
+|}
+!! result
+<table>
+<tr>
+<th><i>Cell</i></th>
+<td>Value</td>
+</tr>
+</table>
+
+!! end
!! test
Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
<table>
<tr>
<td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
-<td>]" onmouseover="alert(document.cookie)">test
-</td>
+<td>]" onmouseover="alert(document.cookie)">test</td>
</tr>
</table>
!! end
+!! test
+Indented Tables, bug 20078
+!! input
+: {|
+| 1 || 2
+|-
+| 3 || 4
+|}
+!! result
+<dl><dd><table>
+<tr>
+<td>1</td>
+<td>2</td>
+</tr>
+<tr>
+<td>3</td>
+<td>4</td>
+</tr>
+</table></dd></dl>
+!! end
###
### Internal links
###
</p>
!!end
+!! test
+Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
+!! options
+language=ca
+!! input
+'''[[Main Page]]'''
+!! result
+<p><b><a href="/wiki/Main_Page">Main Page</a></b>
+</p>
+!! end
+
+!! test
+Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
+!! options
+language=ca
+!! input
+''[[Main Page]]''
+!! result
+<p><i><a href="/wiki/Main_Page">Main Page</a></i>
+</p>
+!! end
+
+!! test
+Internal link with en linktrail: no apostrophes (bug 27473)
+!! options
+language=en
+!! input
+[[Something]]'nice
+!! result
+<p><a href="/index.php?title=Something&action=edit&redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
+</p>
+!! end
+
+!! test
+Internal link with ca linktrail with apostrophes (bug 27473)
+!! options
+language=ca
+!! input
+[[Something]]'nice
+!! result
+<p><a href="/index.php?title=Something&action=edit&redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
+</p>
+!! end
+
+!! test
+Internal link with kaa linktrail with apostrophes (bug 27473)
+!! options
+language=kaa
+!! input
+[[Something]]'nice
+!! result
+<p><a href="/index.php?title=Something&action=edit&redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
+</p>
+!! end
###
### Interwiki links (see maintenance/interwiki.sql)
!! result
<table>
<tr>
-<td>[[{{{1}}}|{{{2}}}]]
-</td></tr></table>
+<td>[[{{{1}}}|{{{2}}}]]</td>
+</tr>
+</table>
!! end
</p>
<table>
<tr>
-<td> 1 </td>
-<td> 2
-</td></tr>
+<td>1</td>
+<td>2</td>
+</tr>
<tr>
-<td> 3 </td>
-<td> 4
-</td></tr></table>
+<td>3</td>
+<td>4</td>
+</tr>
+</table>
!! end
</p>
<table>
<tr>
-<td> 1 </td>
-<td> 2
-</td></tr>
+<td>1</td>
+<td>2</td>
+</tr>
<tr>
-<td> 3 </td>
-<td> 4
-</td></tr></table>
+<td>3</td>
+<td>4</td>
+</tr>
+</table>
!! end
<!-- <nowiki>data</nowiki> -->
!!end
-!! test
-pre-save transform: comment containing math
-!! options
-pst
-!! input
-<!-- <math>data</math> -->
-!!result
-<!-- <math>data</math> -->
-!!end
-
!! test
pre-save transform: <noinclude> in subst (bug 3298)
!! options
!! end
-!! test
-BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
-so math is not stripped and turns up as escaped <math> tags.
-!! input
-[[Image:foobar.jpg|thumb|<math>2+2</math>]]
-!! result
-<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/3/3a/Foobar.jpg" width="180" height="20" 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><math>2+2</math></div></div></div>
-
-!! end
-
-!! test
-BUG 1887, part 2: A <math> with a thumbnail- math enabled
-!! options
-math
-!! input
-[[Image:foobar.jpg|thumb|<math>2+2</math>]]
-!! result
-<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/3/3a/Foobar.jpg" width="180" height="20" 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><span class="texhtml">2 + 2</span></div></div></div>
-
-!! end
-
# Pending resolution to bug 368
!! test
BUG 648: Frameless image caption with a link
!! result
<table>
<tr>
-<th class="awesome"> status
-</th></tr></table>
+<th class="awesome">status</th>
+</tr>
+</table>
!!end
!! end
-!! test
-Math section safety when disabled
-!! input
-<math><script>alert(document.cookies);</script></math>
-!! result
-<p><math><script>alert(document.cookies);</script></math>
-</p>
-!! end
-
# More MSIE fun discovered by Tom Gilder
!! test
!! result
<table>
<tr>
-<th style="color:blue"> status
-</th></tr></table>
+<th style="color:blue">status</th>
+</tr>
+</table>
!!end
!! result
<table>
<tr>
-<th style="/* insecure input */"> status
-</th></tr></table>
+<th style="/* insecure input */">status</th>
+</tr>
+</table>
!! end
!! result
<table>
<tr>
-<td>
-</td>
+<td></td>
</tr>
</table>
!! input
==a==
{| STYLE=__TOC__
+|foo
!! result
<h2><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
<table style="__TOC__">
-<tr><td></td></tr>
+<tr>
+<td>foo</td>
+</tr>
</table>
!! end
<th>https://</th>
<th></th>
<th></th>
-<th>
-</td>
+<th></th>
</tr>
</table>
!! result
<table>
<tr>
-<th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
-</th>
-<td>
-</td>
+<th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"</th>
+<td></td>
</tr>
</table>
http://===r:::https://b
{|
+
!!result
<p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
</p>
-<table>
-<tr><td></td></tr>
-</table>
!! end
+# Known to produce bad XML for now
+
+# Note: the current result listed for this is not what the original one was,
+# but the original bug was JavaScript injection, which is fixed in any case.
+# It's not clear that the original result listed was any more correct than the
+# current one. Original result:
+# <table>
+# {{{|
+# <u class="|">}}}} >
+# <br style="onmouseover='alert(document.cookie);'" />
+#
+# MOVE YOUR MOUSE CURSOR OVER THIS TEXT
+# <tr>
+# <td></u>
+# </td>
+# </tr>
+# </table>
# Known to produce bad XML for now
!! test
Fuzz testing: Parser24
MOVE YOUR MOUSE CURSOR OVER THIS TEXT
|
!! result
-<table>
-{{{|
-<u class="|">}}}} >
-<br style="onmouseover='alert(document.cookie);'" />
-
+<p>{{{|
+</p><p><u class="|">}}}} >
+</p><p><br style="onmouseover='alert(document.cookie);'" />
+</p><p><br />
MOVE YOUR MOUSE CURSOR OVER THIS TEXT
+</p>
+<table>
<tr>
-<td></u>
-</td>
+<td></u></td>
</tr>
</table>
!! end
+!! test
+Gallery (with namespace-less filenames)
+!! input
+<gallery>
+File:Nonexistant.jpg
+Nonexistant.jpg
+image:foobar.jpg
+foobar.jpg
+</gallery>
+!! result
+<ul class="gallery">
+ <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+ <div style="height: 150px;">Nonexistant.jpg</div>
+ <div class="gallerytext">
+ </div>
+ </div></li>
+ <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+ <div style="height: 150px;">Nonexistant.jpg</div>
+ <div class="gallerytext">
+ </div>
+ </div></li>
+ <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+ <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
+ <div class="gallerytext">
+ </div>
+ </div></li>
+ <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+ <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
+ <div class="gallerytext">
+ </div>
+ </div></li>
+</ul>
+
+!! end
+
!! test
HTML Hex character encoding (spells the word "JavaScript")
!! input
</p>
<table>
<tr>
-<td> 1 </td>
-<td> 2
-</td></tr>
+<td>1</td>
+<td>2</td>
+</tr>
<tr>
-<td> 3 </td>
-<td> 4
-</td></tr></table>
+<td>3</td>
+<td>4</td>
+</tr></table>
<p>y
</p>
!! end
<a href="/wiki/Main_Page#section" title="Main Page">#section</a>
!! end
+!! test
+Anchor starting with underscore
+!!input
+[[#_ref|One]]
+!! result
+<p><a href="#_ref">One</a>
+</p>
+!! end
+
+!! test
+Id starting with underscore
+!!input
+<div id="_ref"></div>
+!! result
+<div id="_ref"></div>
+
+!! end
+
!! test
Space normalisation on autocomment (bug 22784)
!! options