Handle one part of bug 32545 while improving MediaWiki's support for Microdata in...
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
index 706d33b..22970a1 100644 (file)
@@ -615,6 +615,26 @@ disabled
 </dl>
 !! end
 
 </dl>
 !! end
 
+!! test
+Definition and unordered list using wiki syntax nested in unordered list using html tags.
+!! input
+<ul><li>
+; term : description 
+* unordered
+</li>
+</ul>
+!! result
+<ul><li>
+<dl><dt> term&#160;</dt><dd> description 
+</dd></dl>
+<ul><li> unordered
+</li></ul>
+</li>
+</ul>
+
+!! end
+
+
 ###
 ### External links
 ###
 ###
 ### External links
 ###
@@ -714,6 +734,42 @@ second]
 </p>
 !!end
 
 </p>
 !!end
 
+!! test
+External links: protocol-relative URL in brackets
+!! input
+[//example.com/ Test]
+!! result
+<p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
+</p>
+!! end
+
+!! test
+External links: protocol-relative URL in brackets without text
+!! input
+[//example.com]
+!! result
+<p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
+</p>
+!! end
+
+!! test
+External links: protocol-relative URL in free text is left alone
+!! input
+//example.com/Foo
+!! result
+<p>//example.com/Foo
+</p>
+!!end
+
+!! test
+External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
+!! input
+foo//example.com/Foo
+!! result
+<p>foo//example.com/Foo
+</p>
+!! end
+
 !! test
 External image
 !! input
 !! test
 External image
 !! input
@@ -975,33 +1031,6 @@ External links: wiki links within external link (Bug 3695)
 </p>
 !! end
 
 </p>
 !! end
 
-!! test
-External links: links containing empty bracket pair []
-!! input
-[http://example.com?parameter[]=foo link]
-!! result
-<p><a rel="nofollow" class="external text" href="http://example.com?parameter%5B%5D=foo">link</a>
-</p>
-!! end
-
-!! test
-External links: links ending in empty bracket pair []
-!! input
-[http://example.com?parameter[]=foo&option[]]
-!! result
-<p><a rel="nofollow" class="external autonumber" href="http://example.com?parameter%5B%5D=foo&amp;option%5B%5D">[1]</a>
-</p>
-!! end
-
-!! test
-External links: bare links ending in empty bracket pair []
-!! input
-http://example.com?parameter[]=foo&option[]
-!! result
-<p><a rel="nofollow" class="external free" href="http://example.com?parameter%5B%5D=foo&amp;option%5B%5D">http://example.com?parameter%5B%5D=foo&amp;option%5B%5D</a>
-</p>
-!! end
-
 !! test
 BUG 787: Links with one slash after the url protocol are invalid
 !! input
 !! test
 BUG 787: Links with one slash after the url protocol are invalid
 !! input
@@ -1041,8 +1070,10 @@ http://www.example.com/?title=AT%26T
 </p>
 !! end
 
 </p>
 !! end
 
+# According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
+# % is actually legal in HTML5. Any change in output would need testing though.
 !! test
 !! test
-Bug 4781, 5267: %26 in URL
+Bug 4781, 5267: %25 in URL
 !! input
 http://www.example.com/?title=100%25_Bran
 !! result
 !! input
 http://www.example.com/?title=100%25_Bran
 !! result
@@ -1160,6 +1191,29 @@ URL-encoding in URL functions (multiple parameters)
 </p>
 !! end
 
 </p>
 !! end
 
+!! test
+Brackets in urls
+!! input
+http://example.com/index.php?foozoid%5B%5D=bar
+
+http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
+!! result
+<p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
+</p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
+</p>
+!! end
+
+!! test
+IPv6 urls (bug 21261)
+!! options
+disabled
+!! input
+http://[2404:130:0:1000::187:2]/index.php
+!! result
+<p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
+</p>
+!! end
+
 ###
 ### Quotes
 ###
 ###
 ### Quotes
 ###
@@ -1237,10 +1291,8 @@ A table with nothing but a caption
 |}
 !! result
 <table>
 |}
 !! result
 <table>
-<caption>caption
-</caption>
-<tr><td></td></tr>
-</table>
+<caption> caption
+</caption><tr><td></td></tr></table>
 
 !! end
 
 
 !! end
 
@@ -1255,14 +1307,13 @@ Simple table
 !! result
 <table>
 <tr>
 !! result
 <table>
 <tr>
-<td>1</td>
-<td>2</td>
-</tr>
+<td> 1 </td>
+<td> 2
+</td></tr>
 <tr>
 <tr>
-<td>3</td>
-<td>4</td>
-</tr>
-</table>
+<td> 3 </td>
+<td> 4
+</td></tr></table>
 
 !! end
 
 
 !! end
 
@@ -1293,52 +1344,54 @@ Multiplication table
 <table border="1" cellpadding="2">
 <caption>Multiplication table
 </caption>
 <table border="1" cellpadding="2">
 <caption>Multiplication table
 </caption>
-<thead>
 <tr>
 <tr>
-<th>&#215;</th>
-<th>1</th>
-<th>2</th>
-<th>3</th>
-</tr></thead>
-<tbody>
+<th> &#215; </th>
+<th> 1 </th>
+<th> 2 </th>
+<th> 3
+</th></tr>
 <tr>
 <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>
 <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>
 <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>
 <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>
 <tr>
-<th>5</th>
-<td>5</td>
-<td>10</td>
-<td>15</td>
-</tr></tbody>
-</table>
+<th> 5
+</th>
+<td> 5 </td>
+<td> 10 </td>
+<td> 15
+</td></tr></table>
 
 !! end
 
 !! test
 Table rowspan
 !! input
 
 !! end
 
 !! test
 Table rowspan
 !! input
-{| align=right border=1
+{| border=1
 | Cell 1, row 1 
 |rowspan=2| Cell 2, row 1 (and 2) 
 | Cell 3, row 1 
 | Cell 1, row 1 
 |rowspan=2| Cell 2, row 1 (and 2) 
 | Cell 3, row 1 
@@ -1347,17 +1400,19 @@ Table rowspan
 | Cell 3, row 2 
 |}
 !! result
 | Cell 3, row 2 
 |}
 !! result
-<table align="right" border="1">
+<table border="1">
 <tr>
 <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>
 <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
 
 
 !! end
 
@@ -1377,19 +1432,19 @@ Nested table
 !! result
 <table border="1">
 <tr>
 !! result
 <table border="1">
 <tr>
-<td>&#945;</td>
+<td> &#945;
+</td>
 <td>
 <table bgcolor="#ABCDEF" border="2">
 <tr>
 <td>
 <table bgcolor="#ABCDEF" border="2">
 <tr>
-<td>nested</td>
-</tr>
+<td>nested
+</td></tr>
 <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
 
 
 !! end
 
@@ -1402,81 +1457,11 @@ Invalid attributes in table cell (bug 1830)
 !! result
 <table>
 <tr>
 !! result
 <table>
 <tr>
-<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>
+<td>broken
+</td></tr></table>
 
 !! end
 
 
 !! 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)
 
 !! test
 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
@@ -1487,33 +1472,37 @@ 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>
 <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
 
 </tr>
 </table>
 
 !! end
 
+
 !! test
 !! test
-Indented Tables, bug 20078
+Indented table markup mixed with indented pre content (proposed in bug 6200)
 !! input
 !! input
-: {| 
-| 1 || 2
-|- 
-| 3 || 4
-|}
+ <table>
+ <tr>
+ <td>
+ Text that should be rendered preformatted
+ </td>
+ </tr>
+ </table>
 !! result
 !! result
-<dl><dd><table>
-<tr>
-<td>1</td>
-<td>2</td>
-</tr>
-<tr>
-<td>3</td>
-<td>4</td>
-</tr>
-</table></dd></dl>
+ <table>
+ <tr>
+ <td>
+<pre>Text that should be rendered preformatted
+</pre>
+ </td>
+ </tr>
+ </table>
 
 !! end
 
 !! end
+
+
 ###
 ### Internal links
 ###
 ###
 ### Internal links
 ###
@@ -1522,7 +1511,7 @@ Plain link, capitalized
 !! input
 [[Main Page]]
 !! result
 !! input
 [[Main Page]]
 !! result
-<p><a href="/wiki/Main_Page">Main Page</a>
+<p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -1531,7 +1520,7 @@ Plain link, uncapitalized
 !! input
 [[main Page]]
 !! result
 !! input
 [[main Page]]
 !! result
-<p><a href="/wiki/Main_Page">main Page</a>
+<p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -1585,7 +1574,7 @@ Link with prefix
 !! input
 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
 !! result
 !! input
 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
 !! result
-<p>xxx<a href="/wiki/Main_Page">main Page</a>, xxx<a href="/wiki/Main_Page">Main Page</a>, Xxx<a href="/wiki/Main_Page">main Page</a> XXX<a href="/wiki/Main_Page">main Page</a>, XXX<a href="/wiki/Main_Page">Main Page</a>
+<p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -1594,7 +1583,7 @@ Link with suffix
 !! input
 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
 !! result
 !! input
 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
 !! result
-<p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page">Main Page</a>XXX, <a href="/wiki/Main_Page">Main Page</a>!!!
+<p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
 </p>
 !! end
 
 </p>
 !! end
 
@@ -1752,6 +1741,34 @@ Plain link to URL
 </p>
 !! end
 
 </p>
 !! end
 
+!! test
+Plain link to URL with link text
+!! input
+[[http://www.example.com Link text]]
+!! result
+<p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
+</p>
+!! end
+
+!! test
+Plain link to protocol-relative URL
+!! input
+[[//www.example.com]]
+!! result
+<p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
+</p>
+!! end
+
+!! test
+Plain link to protocol-relative URL with link text
+!! input
+[[//www.example.com Link text]]
+!! result
+<p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
+</p>
+!! end
+
+
 # I'm fairly sure the expected result here is wrong.
 # We want these to be URL links, not pseudo-pages with URLs for titles....
 # However the current output is also pretty screwy.
 # I'm fairly sure the expected result here is wrong.
 # We want these to be URL links, not pseudo-pages with URLs for titles....
 # However the current output is also pretty screwy.
@@ -1827,7 +1844,7 @@ title=[[0]]
 !!input
 [[00]]
 !!result
 !!input
 [[00]]
 !!result
-<p><a href="/wiki/00">00</a>
+<p><a href="/wiki/00" title="00">00</a>
 </p>
 !!end
 
 </p>
 !!end
 
@@ -1856,7 +1873,7 @@ language=ca
 !! input
 '''[[Main Page]]'''
 !! result
 !! input
 '''[[Main Page]]'''
 !! result
-<p><b><a href="/wiki/Main_Page">Main Page</a></b>
+<p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -1867,7 +1884,7 @@ language=ca
 !! input
 ''[[Main Page]]''
 !! result
 !! input
 ''[[Main Page]]''
 !! result
-<p><i><a href="/wiki/Main_Page">Main Page</a></i>
+<p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -1913,7 +1930,7 @@ Inline interwiki link
 !! input
 [[MeatBall:SoftSecurity]]
 !! result
 !! input
 [[MeatBall:SoftSecurity]]
 !! result
-<p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw">MeatBall:SoftSecurity</a>
+<p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -1922,7 +1939,7 @@ Inline interwiki link with empty title (bug 2372)
 !! input
 [[MeatBall:]]
 !! result
 !! input
 [[MeatBall:]]
 !! result
-<p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw">MeatBall:</a>
+<p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -2019,13 +2036,13 @@ Incorrecly removing closing slashes from correctly formed XHTML
 !! test 
 Failing to transform badly formed HTML into correct XHTML
 !! input
 !! test 
 Failing to transform badly formed HTML into correct XHTML
 !! input
-<br clear=left>
-<br clear=right>
-<br clear=all>
+<br style="clear: left;">
+<br style="clear: right;">
+<br style="clear: both;">
 !! result
 !! result
-<p><br clear="left" />
-<br clear="right" />
-<br clear="all" />
+<p><br style="clear: left;" />
+<br style="clear: right;" />
+<br style="clear: both;" />
 </p>
 !!end
 
 </p>
 !!end
 
@@ -2529,7 +2546,7 @@ Magic links: RFC (bug 479)
 !! input
 RFC 822
 !! result
 !! input
 RFC 822
 !! result
-<p><a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc822">RFC 822</a>
+<p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc822">RFC 822</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -2547,7 +2564,7 @@ Magic links: PMID incorrectly converts space to underscore
 !! input
 PMID 1234
 !! result
 !! input
 PMID 1234
 !! result
-<p><a class="external mw-magiclink-pmid" href="http://www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
+<p><a class="external mw-magiclink-pmid" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -2773,9 +2790,8 @@ BUG 553: link with two variables in a piped link
 !! result
 <table>
 <tr>
 !! result
 <table>
 <tr>
-<td>[[{{{1}}}|{{{2}}}]]</td>
-</tr>
-</table>
+<td>[[{{{1}}}|{{{2}}}]]
+</td></tr></table>
 
 !! end
 
 
 !! end
 
@@ -2830,7 +2846,7 @@ Template as link source
 !! input
 [[{{linktest2}}]]
 !! result
 !! input
 [[{{linktest2}}]]
 !! result
-<p><a href="/wiki/Main_Page">Main Page</a>
+<p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -2852,7 +2868,7 @@ Template infinite loop
 !! input
 {{loop1}}
 !! result
 !! input
 {{loop1}}
 !! result
-<p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1">Template:Loop1</a></span>
+<p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -2884,14 +2900,13 @@ foo {{table}}
 </p>
 <table>
 <tr>
 </p>
 <table>
 <tr>
-<td>1</td>
-<td>2</td>
-</tr>
+<td> 1 </td>
+<td> 2
+</td></tr>
 <tr>
 <tr>
-<td>3</td>
-<td>4</td>
-</tr>
-</table>
+<td> 3 </td>
+<td> 4
+</td></tr></table>
 
 !! end
 
 
 !! end
 
@@ -2905,14 +2920,13 @@ foo
 </p>
 <table>
 <tr>
 </p>
 <table>
 <tr>
-<td>1</td>
-<td>2</td>
-</tr>
+<td> 1 </td>
+<td> 2
+</td></tr>
 <tr>
 <tr>
-<td>3</td>
-<td>4</td>
-</tr>
-</table>
+<td> 3 </td>
+<td> 4
+</td></tr></table>
 
 !! end
 
 
 !! end
 
@@ -3444,6 +3458,140 @@ pst title=[[Ns:Somearticle (IGNORED), Context]]
 [[Ns:Article, Context|Article]]
 !! end
 
 [[Ns:Article, Context|Article]]
 !! end
 
+!! test
+pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
+!! options
+pst
+!! input
+[[Article(context)|]]
+[[Bar:Article(context)|]]
+[[:Bar:Article(context)|]]
+[[|Article(context)]]
+[[Bar:X (Y) Z|]]
+[[:Bar:X (Y) Z|]]
+!! result
+[[Article(context)|Article]]
+[[Bar:Article(context)|Article]]
+[[:Bar:Article(context)|Article]]
+[[Article(context)]]
+[[Bar:X (Y) Z|X (Y) Z]]
+[[:Bar:X (Y) Z|X (Y) Z]]
+!! end
+
+!! test
+pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
+!! options
+pst
+!! input
+[[Article (context)|]]
+[[Bar:Article (context)|]]
+[[:Bar:Article (context)|]]
+[[|Article (context)]]
+[[Bar:X (Y) Z|]]
+[[:Bar:X (Y) Z|]]
+!! result
+[[Article (context)|Article]]
+[[Bar:Article (context)|Article]]
+[[:Bar:Article (context)|Article]]
+[[Article (context)]]
+[[Bar:X (Y) Z|X (Y) Z]]
+[[:Bar:X (Y) Z|X (Y) Z]]
+!! end
+
+!! test
+pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
+!! options
+pst
+!! input
+[[Article(context)|]]
+[[Bar:Article(context)|]]
+[[:Bar:Article(context)|]]
+[[|Article(context)]]
+[[Bar:X(Y)Z|]]
+[[:Bar:X(Y)Z|]]
+!! result
+[[Article(context)|Article]]
+[[Bar:Article(context)|Article]]
+[[:Bar:Article(context)|Article]]
+[[Article(context)]]
+[[Bar:X(Y)Z|X(Y)Z]]
+[[:Bar:X(Y)Z|X(Y)Z]]
+!! end
+
+!! test
+pre-save transform: trim trailing empty lines
+!! options
+pst
+!! input
+Empty lines are trimmed
+
+
+
+
+!! result
+Empty lines are trimmed
+!! end
+
+!! test
+pre-save transform: Signature expansion
+!! options
+pst
+!! input
+* ~~~
+* <noinclude>~~~</noinclude>
+* <includeonly>~~~</includeonly>
+* <onlyinclude>~~~</onlyinclude>
+!! result
+* [[Special:Contributions/127.0.0.1|127.0.0.1]]
+* <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
+* <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
+* <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
+!! end
+
+
+!! test
+pre-save transform: Signature expansion in nowiki tags (bug 93)
+!! options
+pst disabled
+!! input
+Shall not expand:
+
+<nowiki>~~~~</nowiki>
+
+<includeonly><nowiki>~~~~</nowiki></includeonly>
+
+<noinclude><nowiki>~~~~</nowiki></noinclude>
+
+<onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
+
+{{subst:Foo}} shall be converted to FOO
+
+As well as inside noinclude/onlyinclude
+<noinclude>{{subst:Foo}}</noinclude>
+<onlyinclude>{{subst:Foo}}</onlyinclude>
+
+But not inside includeonly
+<includeonly>{{subst:Foo}}</includeonly>
+!! result
+Shall not expand:
+
+<nowiki>~~~~</nowiki>
+
+<includeonly><nowiki>~~~~</nowiki></includeonly>
+
+<noinclude><nowiki>~~~~</nowiki></noinclude>
+
+<onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
+
+FOO shall be converted to FOO
+
+As well as inside noinclude/onlyinclude
+<noinclude>FOO</noinclude>
+<onlyinclude>FOO</onlyinclude>
+
+But not inside includeonly
+<includeonly>{{subst:Foo}}</includeonly>
+!! end
 
 ###
 ### Message transform tests
 
 ###
 ### Message transform tests
@@ -3638,7 +3786,7 @@ Image with frame and link
 !! input
 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
 !! result
 !! input
 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
 !! result
-<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page">Main Page</a></div></div></div>
+<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
 
 !! end
 
 
 !! end
 
@@ -3647,7 +3795,7 @@ Image with frame and link and explicit alt
 !! input
 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
 !! result
 !! input
 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
 !! result
-<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page">Main Page</a></div></div></div>
+<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
 
 !! end
 
 
 !! end
 
@@ -3730,7 +3878,7 @@ BUG 1887: A RFC with a thumbnail
 !! input
 [[Image:foobar.jpg|thumb|This is RFC 12354]]
 !! result
 !! input
 [[Image:foobar.jpg|thumb|This is RFC 12354]]
 !! 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>This is <a class="external mw-magiclink-rfc" href="http://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/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>This is <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
 
 !! end
 
 
 !! end
 
@@ -3847,7 +3995,7 @@ Redirected image
 !! input
 [[Image:Barfoo.jpg]]
 !! result
 !! input
 [[Image:Barfoo.jpg]]
 !! result
-<p><a href="/wiki/File:Barfoo.jpg">File:Barfoo.jpg</a>
+<p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -3858,7 +4006,7 @@ wgEnableUploads=0
 !! input
 [[Image:Foobaz.jpg]]
 !! result
 !! input
 [[Image:Foobaz.jpg]]
 !! result
-<p><a href="/wiki/File:Foobaz.jpg">File:Foobaz.jpg</a>
+<p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -3928,7 +4076,7 @@ Link to category
 !! input
 [[:Category:MediaWiki User's Guide]]
 !! result
 !! input
 [[:Category:MediaWiki User's Guide]]
 !! result
-<p><a href="/wiki/Category:MediaWiki_User%27s_Guide">Category:MediaWiki User's Guide</a>
+<p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -4437,9 +4585,9 @@ div with unquoted attribute
 !! test
 div with illegal double attributes
 !! input
 !! test
 div with illegal double attributes
 !! input
-<div align="center" align="right">HTML rocks</div>
+<div id="a" id="b">HTML rocks</div>
 !! result
 !! result
-<div align="right">HTML rocks</div>
+<div id="b">HTML rocks</div>
 
 !!end
 
 
 !!end
 
@@ -4461,18 +4609,17 @@ Table multiple attributes correction
 !! result
 <table>
 <tr>
 !! result
 <table>
 <tr>
-<th class="awesome">status</th>
-</tr>
-</table>
+<th class="awesome"> status
+</th></tr></table>
 
 !!end
 
 !! test
 DIV IN UPPERCASE
 !! input
 
 !!end
 
 !! test
 DIV IN UPPERCASE
 !! input
-<DIV ALIGN="center">HTML ROCKS</DIV>
+<DIV ID="x">HTML ROCKS</DIV>
 !! result
 !! result
-<div align="center">HTML ROCKS</div>
+<div id="x">HTML ROCKS</div>
 
 !!end
 
 
 !!end
 
@@ -4597,7 +4744,7 @@ The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
-<a href="/wiki/%D7%90%D6%B7">אַ</a>
+<a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -4660,7 +4807,7 @@ Bug 2095: link with three closing brackets
 !! input
 [[Main Page]]]
 !! result
 !! input
 [[Main Page]]]
 !! result
-<p><a href="/wiki/Main_Page">Main Page</a>]
+<p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
 </p>
 !! end
 
 </p>
 !! end
 
@@ -4907,9 +5054,8 @@ Table attribute legitimate extension
 !! result
 <table>
 <tr>
 !! result
 <table>
 <tr>
-<th style="color:blue">status</th>
-</tr>
-</table>
+<th style="color:blue"> status
+</th></tr></table>
 
 !!end
 
 
 !!end
 
@@ -4922,9 +5068,8 @@ Table attribute safety
 !! result
 <table>
 <tr>
 !! result
 <table>
 <tr>
-<th style="/* insecure input */">status</th>
-</tr>
-</table>
+<th style="/* insecure input */"> status
+</th></tr></table>
 
 !! end
 
 
 !! end
 
@@ -5274,6 +5419,26 @@ disabled
 Something need to be done. foo-2 ? 
 !! end
 
 Something need to be done. foo-2 ? 
 !! end
 
+!! test
+Sanitizer: Validating that <meta> and <link> work, but only for Microdata
+!! input
+<div itemscope>
+       <meta itemprop="hello" content="world">
+       <meta http-equiv="refresh" content="5">
+       <link itemprop="hello" href="{{SERVER}}">
+       <link rel="stylesheet" href="{{SERVER}}">
+</div>
+!! result
+<div itemscope="itemscope">
+<p>    <meta itemprop="hello" content="world" />
+       &lt;meta http-equiv="refresh" content="5"&gt;
+</p>
+       <link itemprop="hello" href="http&#58;//Britney-Spears" />
+       &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>"&gt;
+</div>
+
+!! end
+
 !! test
 Language converter: output gets cut off unexpectedly (bug 5757)
 !! options
 !! test
 Language converter: output gets cut off unexpectedly (bug 5757)
 !! options
@@ -5546,7 +5711,8 @@ Fuzz testing: Parser13
 !! result
 <table>
 <tr>
 !! result
 <table>
 <tr>
-<td></td>
+<td>
+</td>
 </tr>
 </table>
 
 </tr>
 </table>
 
@@ -5572,13 +5738,10 @@ Fuzz testing: Parser14-table
 !! input
 ==a==
 {| STYLE=__TOC__
 !! 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;_">
 !! 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>foo</td>
-</tr>
+<tr><td></td></tr>
 </table>
 
 !! end
 </table>
 
 !! end
@@ -5597,7 +5760,8 @@ noxml
 <th>https://</th>
 <th></th>
 <th></th>
 <th>https://</th>
 <th></th>
 <th></th>
-<th></th>
+<th>
+</td>
 </tr>
 </table>
 
 </tr>
 </table>
 
@@ -5612,8 +5776,10 @@ Fuzz testing: Parser21
 !! result
 <table>
 <tr>
 !! 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>
 
 </tr>
 </table>
 
@@ -5625,30 +5791,15 @@ Fuzz testing: Parser22
 http://===r:::https://b
 
 {|
 http://===r:::https://b
 
 {|
-
 !!result
 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
 </p>
 !!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
 
 
 !! 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
 # Known to produce bad XML for now
 !! test
 Fuzz testing: Parser24
@@ -5664,15 +5815,15 @@ noxml
 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 |
 !! result
 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 |
 !! result
-<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>
 <table>
+{{{|
+<u class="&#124;">}}}} &gt;
+<br style="onmouseover=&#39;alert(document.cookie);&#39;" />
+
+MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 <tr>
 <tr>
-<td></u></td>
+<td></u>
+</td>
 </tr>
 </table>
 
 </tr>
 </table>
 
@@ -5858,7 +6009,7 @@ Special page transclusion
 !! result
 <p><br />
 </p>
 !! result
 <p><br />
 </p>
-<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
+<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
 
 !! end
 
 
 !! end
 
@@ -5871,10 +6022,10 @@ Special page transclusion twice (bug 5021)
 !! result
 <p><br />
 </p>
 !! result
 <p><br />
 </p>
-<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
+<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
 <p><br />
 </p>
 <p><br />
 </p>
-<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
+<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
 
 !! end
 
 
 !! end
 
@@ -6769,7 +6920,7 @@ Special:Search page linking.
 !! input
 {{Special:search}}
 !! result
 !! input
 {{Special:search}}
 !! result
-<p><a href="/wiki/Special:Search">Special:Search</a>
+<p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -6874,37 +7025,72 @@ image4    |300px| centre
 !! test
 Gallery (with options)
 !! input
 !! test
 Gallery (with options)
 !! input
-<gallery widths='60px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
+<gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
 File:Nonexistant.jpg|caption
 File:Nonexistant.jpg
 image:foobar.jpg|some '''caption''' [[Main Page]]
 image:foobar.jpg
 File:Nonexistant.jpg|caption
 File:Nonexistant.jpg
 image:foobar.jpg|some '''caption''' [[Main Page]]
 image:foobar.jpg
+image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
 </gallery>
 !! result
 </gallery>
 !! result
-<ul class="gallery" style="max-width: 202px;_width: 202px;">
-       <li class='gallerycaption'>Foo <a href="/wiki/Main_Page">Main Page</a></li>
-               <li class="gallerybox" style="width: 95px"><div style="width: 95px">
+<ul class="gallery" style="max-width: 226px;_width: 226px;">
+       <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
+               <li class="gallerybox" style="width: 105px"><div style="width: 105px">
                        <div style="height: 70px;">Nonexistant.jpg</div>
                        <div class="gallerytext">
 <p>caption
 </p>
                        </div>
                </div></li>
                        <div style="height: 70px;">Nonexistant.jpg</div>
                        <div class="gallerytext">
 <p>caption
 </p>
                        </div>
                </div></li>
-               <li class="gallerybox" style="width: 95px"><div style="width: 95px">
+               <li class="gallerybox" style="width: 105px"><div style="width: 105px">
                        <div style="height: 70px;">Nonexistant.jpg</div>
                        <div class="gallerytext">
                        </div>
                </div></li>
                        <div style="height: 70px;">Nonexistant.jpg</div>
                        <div class="gallerytext">
                        </div>
                </div></li>
-               <li class="gallerybox" style="width: 95px"><div style="width: 95px">
-                       <div class="thumb" style="width: 90px;"><div style="margin:26px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
+               <li class="gallerybox" style="width: 105px"><div style="width: 105px">
+                       <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
+                       <div class="gallerytext">
+<p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
+</p>
+                       </div>
+               </div></li>
+               <li class="gallerybox" style="width: 105px"><div style="width: 105px">
+                       <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
+                       <div class="gallerytext">
+                       </div>
+               </div></li>
+               <li class="gallerybox" style="width: 105px"><div style="width: 105px">
+                       <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
+                       <div class="gallerytext">
+<p>Blabla|blabla.
+</p>
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
+!! test
+Gallery with wikitext inside caption
+!! input
+<gallery>
+File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
+File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
+</gallery>
+!! result
+<ul class="gallery">
+               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
                        <div class="gallerytext">
                        <div class="gallerytext">
-<p>some <b>caption</b> <a href="/wiki/Main_Page">Main Page</a>
+<p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/3/3a/Foobar.jpg" width="20" height="2" /></a>
 </p>
                        </div>
                </div></li>
 </p>
                        </div>
                </div></li>
-               <li class="gallerybox" style="width: 95px"><div style="width: 95px">
-                       <div class="thumb" style="width: 90px;"><div style="margin:26px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
+               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
                        <div class="gallerytext">
                        <div class="gallerytext">
+<p>This is a test template
+</p>
                        </div>
                </div></li>
 </ul>
                        </div>
                </div></li>
 </ul>
@@ -6938,15 +7124,15 @@ caption
                        </div>
                </div></li>
                <li class="gallerybox" style="width: 155px"><div style="width: 155px">
                        </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="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
+                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
                        <div class="gallerytext">
 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
                        <div class="gallerytext">
 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
-some <b>caption</b> <a href="/wiki/Main_Page">Main Page</a>
+some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
 </p>
                        </div>
                </div></li>
                <li class="gallerybox" style="width: 155px"><div style="width: 155px">
 </p>
                        </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="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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
                        <div class="gallerytext">
 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
 </p>
                        <div class="gallerytext">
 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
 </p>
@@ -6978,12 +7164,12 @@ foobar.jpg
                        </div>
                </div></li>
                <li class="gallerybox" style="width: 155px"><div style="width: 155px">
                        </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="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/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="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="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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
                        <div class="gallerytext">
                        </div>
                </div></li>
                        <div class="gallerytext">
                        </div>
                </div></li>
@@ -7069,7 +7255,7 @@ Double RFC
 !! input
 RFC RFC 1234
 !! result
 !! input
 RFC RFC 1234
 !! result
-<p>RFC <a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
+<p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -7087,7 +7273,7 @@ RFC code coverage
 !! input
 RFC   983&#x20;987
 !! result
 !! input
 RFC   983&#x20;987
 !! result
-<p><a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
+<p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
 </p>
 !! end
 
 </p>
 !! end
 
@@ -7567,7 +7753,7 @@ language=sr
 !! input
 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
 !! result
 !! input
 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
 !! result
-<p><a href="/wiki/Main_Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
+<p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
 </p>
 !!end
 
 </p>
 !!end
 
@@ -7662,7 +7848,7 @@ language=sr variant=sr-ec
 !! input
 -{[[Main Page]]}-
 !! result
 !! input
 -{[[Main Page]]}-
 !! result
-<p><a href="/wiki/Main_Page">Main Page</a>
+<p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -7674,7 +7860,7 @@ language=sr variant=sr-ec
 !! input
 == -{Naslov}- ==
 !! result
 !! input
 == -{Naslov}- ==
 !! result
-<h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2>
+<h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2>
 
 !! end
 
 
 !! end
 
 </p>
 <table>
 <tr>
 </p>
 <table>
 <tr>
-<td>1</td>
-<td>2</td>
-</tr>
+<td> 1 </td>
+<td> 2
+</td></tr>
 <tr>
 <tr>
-<td>3</td>
-<td>4</td>
-</tr></table>
+<td> 3 </td>
+<td> 4
+</td></tr></table>
 <p>y
 </p>
 !! end
 <p>y
 </p>
 !! end
@@ -8164,9 +8350,9 @@ wgLinkHolderBatchSize=0
 [[meatball:2]]
 [[meatball:3]]
 !! result
 [[meatball:2]]
 [[meatball:3]]
 !! result
-<p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw">meatball:1</a>
-<a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw">meatball:2</a>
-<a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw">meatball:3</a>
+<p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
+<a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
+<a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
 </p>
 !! end
 
 </p>
 !! end
 
@@ -8283,7 +8469,7 @@ comment
 !! input
 I like the [[Main Page]] a lot
 !! result
 !! input
 I like the [[Main Page]] a lot
 !! result
-I like the <a href="/wiki/Main_Page">Main Page</a> a lot
+I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
 !!end
 
 !! test
 !!end
 
 !! test
@@ -8313,7 +8499,7 @@ comment title=[[Main Page]]
 !! input
 /* External links */ removed bogus entries
 !! result
 !! input
 /* External links */ removed bogus entries
 !! result
-<span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
+<a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
 !!end
 
 !! test
 !!end
 
 !! test
@@ -8323,7 +8509,7 @@ comment local title=[[Main Page]]
 !! input
 /* External links */ removed bogus entries
 !! result
 !! input
 /* External links */ removed bogus entries
 !! result
-<span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
+<a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
 !!end
 
 !! test
 !!end
 
 !! test
@@ -8410,7 +8596,7 @@ title=[[Main Page]]
 !!input
 /* __hello__world__ */
 !! result
 !!input
 /* __hello__world__ */
 !! result
-<span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span>
+<a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
 !! end
 
 !! test
 !! end
 
 !! test
@@ -8425,6 +8611,8 @@ comment
 
 !! test
 Bad images - basic functionality
 
 !! test
 Bad images - basic functionality
+!! options
+disabled
 !! input
 [[File:Bad.jpg]]
 !! result
 !! input
 [[File:Bad.jpg]]
 !! result
@@ -8432,6 +8620,8 @@ Bad images - basic functionality
 
 !! test
 Bad images - bug 16039: text after bad image disappears
 
 !! test
 Bad images - bug 16039: text after bad image disappears
+!! options
+disabled
 !! input
 Foo bar
 [[File:Bad.jpg]]
 !! input
 Foo bar
 [[File:Bad.jpg]]
@@ -8635,27 +8825,287 @@ Special characters in embedded file links (bug 27679)
 </p>
 !! end
 
 </p>
 !! end
 
+
+!! test
+Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
+!! input
+Text&apos;s been normalized?
+!! result
+<p>Text&#39;s been normalized?
+</p>
+!! end
+
+!! test
+Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
+!! input
+http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
+!! result
+<p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
+</p>
+!! end
+
+!! test
+Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
+!! input
+[http://www.example.org/ ideograms]
+!! result
+<p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
+</p>
+!! end
+
+!! test
+Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
+!! input
+http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
+!! result
+<p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
+</p>
+!! end
+
+!! article
+Mediawiki:loop1
+!! text
+{{Identical|A}}
+!! endarticle
+
 !! article
 !! article
-A
+Mediawiki:loop2
 !! text
 !! text
-A
+{{Identical|B}}
 !! endarticle
 
 !! article
 !! endarticle
 
 !! article
+Template:Identical
 !! text
 !! text
+{{int:loop1}}
+{{int:loop2}}
 !! endarticle
 
 !! test
 !! endarticle
 
 !! test
-Bug#542 Link text shouldn't be duplicated in title attributes
+Bug 31098 Template which includes system messages which includes the template
+!! input
+{{Identical}}
+!! result
+<p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
+<span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
+</p>
+!! end
+
+!! test
+Deprecated presentational attributes are converted to css
+!! input
+{|
+| valign=top align=left width=100 height=25% | Asdf
+|}
+<ul type="disc"></ul>
+!! result
+<table>
+<tr>
+<td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
+</td></tr></table>
+<ul style="list-style-type: disc;"></ul>
+
+!! end
+
+!! test
+Bug31490 Turkish: ucfirst 'blah'
+!! options
+language=tr
+!! input
+{{ucfirst:blah}}
+!! result
+<p>Blah
+</p>
+!! end
+
+!! test
+Bug31490 Turkish: ucfirst 'ix'
+!! options
+language=tr
+!! input
+{{ucfirst:ix}}
+!! result
+<p>İx
+</p>
+!! end
+
+!! test
+Bug31490 Turkish: lcfirst 'BLAH'
+!! options
+language=tr
+!! input
+{{lcfirst:BLAH}}
+!! result
+<p>bLAH
+</p>
+!! end
+
+!! test
+Bug31490 Turkish: ucfırst (with a dotless i)
+!! options
+language=tr
+!! input
+{{ucfırst:blah}}
+!! result
+<p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
+</p>
+!! end
+
+!! test
+Bug31490 ucfırst (with a dotless i) with English language
+!! options
+language=en
+!! input
+{{ucfırst:blah}}
+!! result
+<p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
+</p>
+!! end
+
+!! test
+Bug 26375: TOC with italics
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== ''Lost'' episodes ==
+!! result
+<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
+</ul>
+</td></tr></table>
+<h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span> <span class="mw-headline" id="Lost_episodes"> <i>Lost</i> episodes </span></h2>
+
+!! end
+
+!! test
+Bug 26375: TOC with bold 
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== '''should be bold''' then normal text ==
+!! result
+<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
+</ul>
+</td></tr></table>
+<h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span> <span class="mw-headline" id="should_be_bold_then_normal_text"> <b>should be bold</b> then normal text </span></h2>
+
+!! end
+
+!! test
+Bug 33845: Headings become cursive in TOC when they contain an image
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== Image [[Image:foobar.jpg]] ==
+!! result
+<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
+</ul>
+</td></tr></table>
+<h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span> <span class="mw-headline" id="Image"> Image <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> </span></h2>
+
+!! end
+
+!! test
+Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== <blockquote>Quote</blockquote> ==
+!! result
+<table id="toc" class="toc"><tr><td><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>
+</td></tr></table>
+<h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span> <span class="mw-headline" id="Quote"> <blockquote>Quote</blockquote> </span></h2>
+
+!! end
+
+!! test
+Unclosed tags in TOC
+!! options
+title=[[Main Page]]
 !! input
 !! input
-[[A]] [[a]] [[Ä]] [[ä]]
+__TOC__
+== Proof: 2 < 3 ==
+<small>Hanc marginis exiguitas non caperet.</small>
+QED
 !! result
 !! result
-<p><a href="/wiki/A">A</a> <a href="/wiki/A">a</a> <a href="/wiki/%C3%84">Ä</a> <a href="/wiki/%C3%84">ä</a>
+<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
+</ul>
+</td></tr></table>
+<h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span> <span class="mw-headline" id="Proof:_2_.3C_3"> Proof: 2 &lt; 3 </span></h2>
+<p><small>Hanc marginis exiguitas non caperet.</small>
+QED
 </p>
 !! end
 
 </p>
 !! end
 
+!! test
+Multiple tags in TOC
+!! input
+__TOC__
+== <i>Foo</i> <b>Bar</b> ==
+
+== <i>Foo</i> <blockquote>Bar</blockquote> ==
+!! result
+<table id="toc" class="toc"><tr><td><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>
+</td></tr></table>
+<h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar"> <i>Foo</i> <b>Bar</b> </span></h2>
+<h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> <i>Foo</i> <blockquote>Bar</blockquote> </span></h2>
+
+!! end
+
+!! test
+Tags with parameters in TOC
+!! input
+__TOC__
+== <sup class="in-h2">Hello</sup> ==
+
+== <sup class="a > b">Evilbye</sup> ==
+!! result
+<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
+<li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
+</ul>
+</td></tr></table>
+<h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span> <span class="mw-headline" id="Hello"> <sup class="in-h2">Hello</sup> </span></h2>
+<h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span> <span class="mw-headline" id="b.22.3EEvilbye"> <sup> b"&gt;Evilbye</sup> </span></h2>
+
+!! end
+
+!! article
+MediaWiki:Bug32057
+!! text
+== {{int:headline_sample}} ==
+!! endarticle
+
+!! test
+Bug 32057: Title needed when expanding <h> nodes.
+!! options
+title=[[Main Page]]
+!! input
+{{int:Bug32057}}
+!! result
+<h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span> <span class="mw-headline" id="Headline_text"> Headline text </span></h2>
+
+!! end
+
 TODO:
 more images
 more tables
 TODO:
 more images
 more tables