Another evil test to join r86004 (didn't produce malformed output in the pre-r85922...
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
index 815b542..706d33b 100644 (file)
@@ -1237,8 +1237,10 @@ A table with nothing but a caption
 |}
 !! result
 <table>
-<caption> caption
-</caption><tr><td></td></tr></table>
+<caption>caption
+</caption>
+<tr><td></td></tr>
+</table>
 
 !! end
 
@@ -1253,13 +1255,14 @@ Simple table
 !! 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
 
@@ -1290,47 +1293,45 @@ Multiplication table
 <table border="1" cellpadding="2">
 <caption>Multiplication table
 </caption>
+<thead>
 <tr>
-<th> &#215; </th>
-<th> 1 </th>
-<th> 2 </th>
-<th> 3
-</th></tr>
+<th>&#215;</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
 
@@ -1348,17 +1349,15 @@ Table rowspan
 !! 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
 
@@ -1378,19 +1377,19 @@ Nested table
 !! result
 <table border="1">
 <tr>
-<td> &#945;
-</td>
+<td>&#945;</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
 
@@ -1403,11 +1402,81 @@ Invalid attributes in table cell (bug 1830)
 !! 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&amp;action=edit&amp;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)
@@ -1418,14 +1487,33 @@ Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitec
 <table>
 <tr>
 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
-<td>]" onmouseover="alert(document.cookie)"&gt;test
-</td>
+<td>]" onmouseover="alert(document.cookie)"&gt;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
 ###
@@ -1761,6 +1849,60 @@ Non-breaking spaces in title
 </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&amp;action=edit&amp;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&amp;action=edit&amp;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&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
+</p>
+!! end
 
 ###
 ### Interwiki links (see maintenance/interwiki.sql)
@@ -2631,8 +2773,9 @@ BUG 553: link with two variables in a piped link
 !! result
 <table>
 <tr>
-<td>[[{{{1}}}|{{{2}}}]]
-</td></tr></table>
+<td>[[{{{1}}}|{{{2}}}]]</td>
+</tr>
+</table>
 
 !! end
 
@@ -2741,13 +2884,14 @@ foo {{table}}
 </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
 
@@ -2761,13 +2905,14 @@ foo
 </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
 
@@ -3099,16 +3244,6 @@ pst
 <!-- <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
@@ -3608,27 +3743,6 @@ BUG 1887: A mailto link with a thumbnail
 
 !! 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 &lt;math&gt; 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>&lt;math&gt;2+2&lt;/math&gt;</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
@@ -4347,8 +4461,9 @@ Table multiple attributes correction
 !! result
 <table>
 <tr>
-<th class="awesome"> status
-</th></tr></table>
+<th class="awesome">status</th>
+</tr>
+</table>
 
 !!end
 
@@ -4744,15 +4859,6 @@ Bug 3244: HTML attribute safety (extension; unsafe)
 
 !! end
 
-!! test
-Math section safety when disabled
-!! input
-<math><script>alert(document.cookies);</script></math>
-!! result
-<p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
-</p>
-!! end
-
 # More MSIE fun discovered by Tom Gilder
 
 !! test
@@ -4801,8 +4907,9 @@ Table attribute legitimate extension
 !! result
 <table>
 <tr>
-<th style="color:blue"> status
-</th></tr></table>
+<th style="color:blue">status</th>
+</tr>
+</table>
 
 !!end
 
@@ -4815,8 +4922,9 @@ Table attribute safety
 !! result
 <table>
 <tr>
-<th style="/* insecure input */"> status
-</th></tr></table>
+<th style="/* insecure input */">status</th>
+</tr>
+</table>
 
 !! end
 
@@ -5438,8 +5546,7 @@ Fuzz testing: Parser13
 !! result
 <table>
 <tr>
-<td>
-</td>
+<td></td>
 </tr>
 </table>
 
@@ -5465,10 +5572,13 @@ Fuzz testing: Parser14-table
 !! input
 ==a==
 {| STYLE=__TOC__
+|foo
 !! result
 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
 <table style="&#95;_TOC&#95;_">
-<tr><td></td></tr>
+<tr>
+<td>foo</td>
+</tr>
 </table>
 
 !! end
@@ -5487,8 +5597,7 @@ noxml
 <th>https://</th>
 <th></th>
 <th></th>
-<th>
-</td>
+<th></th>
 </tr>
 </table>
 
@@ -5503,10 +5612,8 @@ Fuzz testing: Parser21
 !! 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>
 
@@ -5518,15 +5625,30 @@ Fuzz testing: Parser22
 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="&#124;">}}}} &gt;
+# <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
+# 
+# MOVE YOUR MOUSE CURSOR OVER THIS TEXT
+# <tr>
+# <td></u>
+# </td>
+# </tr>
+# </table>
 # Known to produce bad XML for now
 !! test
 Fuzz testing: Parser24
@@ -5542,15 +5664,15 @@ noxml
 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 |
 !! result
-<table>
-{{{|
-<u class="&#124;">}}}} &gt;
-<br style="onmouseover=&#39;alert(document.cookie);&#39;" />
-
+<p>{{{|
+</p><p><u class="&#124;">}}}} &gt;
+</p><p><br style="onmouseover=&#39;alert(document.cookie);&#39;" />
+</p><p><br />
 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
+</p>
+<table>
 <tr>
-<td></u>
-</td>
+<td></u></td>
 </tr>
 </table>
 
@@ -6834,6 +6956,41 @@ some <b>caption</b> <a href="/wiki/Main_Page">Main Page</a>
 
 !! 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
@@ -8227,6 +8384,24 @@ title=[[Main Page]]
 <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