Two new parser tests related to bug 6200
[lhc/web/wiklou.git] / maintenance / parserTests.txt
index 264e207..12a2cd1 100644 (file)
@@ -370,6 +370,21 @@ Regression with preformatted in <center>
 
 !! end
 
+# Expected output in the following test is not really expected (there should be
+# <pre> in the output) -- it's only testing for well-formedness.
+!! test
+Bug 6200: Preformatted in <blockquote>
+!! input
+<blockquote>
+ Blah
+</blockquote>
+!! result
+<blockquote>
+ Blah
+</blockquote>
+
+!! end
+
 !! test
 <pre> with attributes (bug 3202)
 !! input
@@ -402,7 +417,7 @@ Regression with preformatted in <center>
 !! input
 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
 !! result
-<pre width="8">Narrow screen goodies</pre>
+<pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
 
 !! end
 
@@ -414,7 +429,7 @@ Simple definition
 !! input
 ; name : Definition
 !! result
-<dl><dt> name&nbsp;</dt><dd> Definition
+<dl><dt> name&#160;</dt><dd> Definition
 </dd></dl>
 
 !! end
@@ -444,7 +459,7 @@ Definition list with URL link
 !! input
 ; http://example.com/ : definition
 !! result
-<dl><dt> <a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
+<dl><dt> <a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a>&#160;</dt><dd> definition
 </dd></dl>
 
 !! end
@@ -495,7 +510,7 @@ Definition lists: colon in external link text
 !! input
 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
 !! result
-<dl><dt> <a href="http://www.wikipedia2.org/" class="external text" rel="nofollow">Wikipedia&nbsp;: The Next Generation</a></dt><dd> OK, I made that up
+<dl><dt> <a href="http://www.wikipedia2.org/" class="external text" rel="nofollow">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
 </dd></dl>
 
 !! end
@@ -516,7 +531,7 @@ Definition lists: self-closed tag
 !! input
 ;one<br/>two : two-line fun
 !! result
-<dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
+<dl><dt>one<br />two&#160;</dt><dd> two-line fun
 </dd></dl>
 
 !! end
@@ -864,18 +879,6 @@ BUG 289: literal double quote in bracketed URL
 </p>
 !!end
 
-!! test
-External links: invalid character
-Fixme: the missing char seems to have gone missing
-!! options
-disabled
-!! input
-[http://www.example.com  test]
-!! result
-<p>[<a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a>  test]
-</p>
-!! end
-
 !! test
 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
 !! input
@@ -1025,6 +1028,15 @@ External link containing double-single-quotes in text embedded in italics (bug 4
 </p>
 !! end
 
+!! test
+External link containing double-single-quotes with no space separating the url from text in italics
+!! input
+[http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
+!! result
+<p><a href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm" class="external text" rel="nofollow"><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>
+!! end
+
 !! test
 URL-encoding in URL functions (single parameter)
 !! input
@@ -1136,10 +1148,12 @@ Simple table
 !! result
 <table>
 <tr>
-<td> 1 </td><td> 2
+<td> 1 </td>
+<td> 2
 </td></tr>
 <tr>
-<td> 3 </td><td> 4
+<td> 3 </td>
+<td> 4
 </td></tr></table>
 
 !! end
@@ -1172,27 +1186,45 @@ Multiplication table
 <caption>Multiplication table
 </caption>
 <tr>
-<th> &times; </th><th> 1 </th><th> 2 </th><th> 3
+<th> &times; </th>
+<th> 1 </th>
+<th> 2 </th>
+<th> 3
 </th></tr>
 <tr>
 <th> 1
-</th><td> 1 </td><td> 2 </td><td> 3
+</th>
+<td> 1 </td>
+<td> 2 </td>
+<td> 3
 </td></tr>
 <tr>
 <th> 2
-</th><td> 2 </td><td> 4 </td><td> 6
+</th>
+<td> 2 </td>
+<td> 4 </td>
+<td> 6
 </td></tr>
 <tr>
 <th> 3
-</th><td> 3 </td><td> 6 </td><td> 9
+</th>
+<td> 3 </td>
+<td> 6 </td>
+<td> 9
 </td></tr>
 <tr>
 <th> 4
-</th><td> 4 </td><td> 8 </td><td> 12
+</th>
+<td> 4 </td>
+<td> 8 </td>
+<td> 12
 </td></tr>
 <tr>
 <th> 5
-</th><td> 5 </td><td> 10 </td><td> 15
+</th>
+<td> 5 </td>
+<td> 10 </td>
+<td> 15
 </td></tr></table>
 
 !! end
@@ -1212,12 +1244,15 @@ Table rowspan
 <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>
+<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>
+<td> Cell 3, row 2
 </td></tr></table>
 
 !! end
@@ -1239,7 +1274,8 @@ Nested table
 <table border="1">
 <tr>
 <td> &alpha;
-</td><td>
+</td>
+<td>
 <table bgcolor="#ABCDEF" border="2">
 <tr>
 <td>nested
@@ -1247,7 +1283,8 @@ Nested table
 <tr>
 <td>table
 </td></tr></table>
-</td><td>the original table again
+</td>
+<td>the original table again
 </td></tr></table>
 
 !! end
@@ -1267,20 +1304,16 @@ Invalid attributes in table cell (bug 1830)
 !! end
 
 
-# FIXME: It's not clear at all that this is the result we want, but the actual
-# output right now is invalid XML, so clearly something is wrong.  The result
-# specified here is now valid XML, which is an improvement . . .
 !! test
 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
-!! options
-disabled
 !! input
 {|
 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
 !! result
 <table>
 <tr>
-<td><a href="ftp://|x||" class="external autonumber" title="ftp://|x||" rel="nofollow">[1]</a></td><td>" onmouseover="alert(document.cookie)"&gt;test
+<td>[<a href="ftp://%7Cx" class="external free" rel="nofollow">ftp://%7Cx</a></td>
+<td>]" onmouseover="alert(document.cookie)"&gt;test
 </td>
 </tr>
 </table>
@@ -1474,12 +1507,10 @@ Link containing "<#" and ">#" as a hex sequences
 
 !! test
 Link containing double-single-quotes '' (bug 4598)
-!! options
-disabled
 !! input
 [[Lista d''e paise d''o munno]]
 !! result
-<p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit" class="new" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a>
+<p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
 </p>
 !! end
 
@@ -1497,7 +1528,25 @@ Link containing double-single-quotes '' in text embedded in italics (bug 4598 sa
 !! input
 ''Some [[Link|pretty ''italics'' and stuff]]!
 !! result
-<p><i>Some </i><a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
+<p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
+</p>
+!! end
+
+!! test
+Link with double quotes in title part (literal) and alternate part (interpreted)
+!! input
+[[File:Denys Savchenko ''Pentecoste''.jpg]]
+
+[[''Pentecoste'']]
+
+[[''Pentecoste''|Pentecoste]]
+
+[[''Pentecoste''|''Pentecoste'']]
+!! result
+<p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
+</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
+</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
+</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
 </p>
 !! end
 
@@ -1526,7 +1575,7 @@ Piped link to URL
 !! input
 Piped link to URL: [[http://www.example.com|an example URL]]
 !! result
-<p>Piped link to URL: [<a href="http://www.example.com|an" class="external text" rel="nofollow">example URL</a>]
+<p>Piped link to URL: [<a href="http://www.example.com%7Can" class="external text" rel="nofollow">example URL</a>]
 </p>
 !! end
 
@@ -1981,15 +2030,6 @@ title=[[User:Ævar Arnfjörð Bjarmason]]
 </p>
 !! end
 
-!! test
-Magic Word: {{NUMBEROFARTICLES}}
-!! input
-{{NUMBEROFARTICLES}}
-!! result
-<p>2
-</p>
-!! end
-
 !! test
 Magic Word: {{NUMBEROFFILES}}
 !! input
@@ -2021,21 +2061,6 @@ title=[[User:Ævar Arnfjörð Bjarmason]]
 </p>
 !! end
 
-!! test
-Magic Word: {{#PIPETRICK:}}
-!! options
-title=[[Some (page)]]
-!! input
-{{#pipetrick:Hello (one)}}
-{{#pipetrick:World, hi|}}
-{{#pipetrick:|Other}}
-!! result
-<p>Hello
-World
-Other (page)
-</p>
-!! end
-
 !! test
 Magic Word: {{REVISIONID}}
 !! input
@@ -2192,6 +2217,21 @@ language=de
 !! end
 
 
+!! test
+Urlencode
+!! input
+{{urlencode:hi world?!}}
+{{urlencode:hi world?!|WIKI}}
+{{urlencode:hi world?!|PATH}}
+{{urlencode:hi world?!|QUERY}}
+!! result
+<p>hi+world%3F%21
+hi_world%3F!
+hi%20world%3F%21
+hi+world%3F%21
+</p>
+!! end
+
 ###
 ### Magic links
 ###
@@ -2563,10 +2603,12 @@ foo {{table}}
 </p>
 <table>
 <tr>
-<td> 1 </td><td> 2
+<td> 1 </td>
+<td> 2
 </td></tr>
 <tr>
-<td> 3 </td><td> 4
+<td> 3 </td>
+<td> 4
 </td></tr></table>
 
 !! end
@@ -2581,10 +2623,12 @@ foo
 </p>
 <table>
 <tr>
-<td> 1 </td><td> 2
+<td> 1 </td>
+<td> 2
 </td></tr>
 <tr>
-<td> 3 </td><td> 4
+<td> 3 </td>
+<td> 4
 </td></tr></table>
 
 !! end
@@ -2603,7 +2647,7 @@ BUG 41: Template parameters shown as broken links
 Template:MSGNW test
 !! text
 ''None'' of '''this''' should be 
-* interepreted
+* interpreted
  but rather passed unmodified
 {{test}}
 !! endarticle
@@ -2617,7 +2661,7 @@ disabled
 {{msgnw:MSGNW test}}
 !! result
 <p>''None'' of '''this''' should be 
-* interepreted
+* interpreted
  but rather passed unmodified
 {{test}}
 </p>
@@ -3013,36 +3057,6 @@ pst
 [[:Bar:X (Y) Z|X (Y) Z]]
 !! end
 
-!! test
-pre-save transform: context links ("pipe trick") based on current page
-!! options
-pst
-!! input
-[[#section|]]
-[[#section (context)|]]
-[[/relative|]]
-[[../context/relative|]]
-[[../context/relative (extra)|]]
-!! result
-[[#section|section]]
-[[#section (context)|section]]
-[[/relative|relative]]
-[[../context/relative|relative]]
-[[../context/relative (extra)|relative]]
-!! end
-
-!! test
-pre-save transform: context links ("pipe trick") with full-width characters
-!! options
-pst
-!! input
-[[title, context|]]
-[[title (context)|]]
-!! result
-[[title, context|title]]
-[[title (context)|title]]
-!! end
-
 !! test
 pre-save transform: context links ("pipe trick") with interwiki prefix
 !! options
@@ -3157,65 +3171,6 @@ pst title=[[Ns:Somearticle (IGNORED), Context]]
 [[Ns:Article, Context|Article]]
 !! end
 
-!! test
-pre-save transform: context links ("pipe trick") with url escaped page names
-!! options
-pst
-!! input
-[[Hello wo%52ld|]]
-[[Hello wo%52ld (again)|]]
-!! result
-[[Hello wo%52ld|Hello woRld]]
-[[Hello wo%52ld (again)|Hello woRld]]
-!! end
-
-!! test
-pre-save transform: context links ("pipe trick") with variables are not pre-empted
-!! options
-pst title=[[Test (page)]]
-!! input
-[[{{{1|}}}|]]
-[[|{{{1|}}}]]
-[[{{subst:PAGENAME}}|]]
-!! result
-[[{{{1|}}}|]]
-[[|{{{1|}}}]]
-[[Test (page)|Test]]
-!! end
-
-!! article
-Template:pipetest
-!! text
-[[{{{1}}}|]]
-!! endarticle
-
-!! article
-Template:testpipe
-!! text
-[[|{{{1}}}]]
-!! endarticle
-
-!! test
-("pipe trick") should work outside PST
-!!options
-title=[[Help:hello (world)]]
-!! input 
-{{pipetest|hi (world)}}
-{{pipetest|hi (world), world}}
-{{pipetest|Help:hi (world), world}}
-{{pipetest|:Help:hi (world), world}}
-{{testpipe|hi}}
-[[{{PAGENAME}}|]]
-!! result
-<p><a href="/index.php?title=Hi_(world)&amp;action=edit&amp;redlink=1" class="new" title="Hi (world) (page does not exist)">hi</a>
-<a href="/index.php?title=Hi_(world),_world&amp;action=edit&amp;redlink=1" class="new" title="Hi (world), world (page does not exist)">hi</a>
-<a href="/index.php?title=Help:Hi_(world),_world&amp;action=edit&amp;redlink=1" class="new" title="Help:Hi (world), world (page does not exist)">hi</a>
-<a href="/index.php?title=Help:Hi_(world),_world&amp;action=edit&amp;redlink=1" class="new" title="Help:Hi (world), world (page does not exist)">hi</a>
-<a href="/index.php?title=Hi_(world)&amp;action=edit&amp;redlink=1" class="new" title="Hi (world) (page does not exist)">hi</a>
-<a href="/index.php?title=Hello_(world)&amp;action=edit&amp;redlink=1" class="new" title="Hello (world) (page does not exist)">Hello</a>
-</p>
-!! end
-
 
 ###
 ### Message transform tests
@@ -3270,6 +3225,16 @@ msg
 Special:RecentChanges
 !! end
 
+!! test
+{{#special:}} page name with subpage, known
+!! options
+msg
+!! input
+{{#special:Recentchanges/param}}
+!! result
+Special:RecentChanges/param
+!! end
+
 !! test
 {{#special:}} page name, unknown
 !! options
@@ -3364,7 +3329,14 @@ Image with link parameter (URL target) and unnamed parameter
 </p>
 !! end
 
+!! test
+Thumbnail image with link parameter
+!! input
+[[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
+!! result
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><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>Title</div></div></div>
 
+!! end
 
 !! test
 Image with frame and link
@@ -3993,6 +3965,23 @@ http://example.com [[Image:foobar.jpg]]
 </p>
 !!end
 
+!! test
+Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
+!! input
+=== 
+The line above must have a trailing space!
+=== <!--
+--> <!-- -->
+But just in case it doesn't...
+!! result
+<h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
+<p>The line above must have a trailing space!
+</p>
+<h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
+<p>But just in case it doesn't...
+</p>
+!! end
+
 !! test
 BUG 1219 URL next to image (broken)
 !! input
@@ -4208,6 +4197,31 @@ Character reference normalization in link text (bug 1938)
 </p>
 !!end
 
+!! article
+אַ
+!! text
+Test for unicode normalization
+
+The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
+!! endarticle
+
+!! test
+(bug 19451) Links should refer to the normalized form.
+!! input
+[[&#xFB2E;]]
+[[&#x5d0;&#x5b7;]]
+[[&#x5d0;ַ]]
+[[א&#x5b7;]]
+[[אַ]]
+!! result
+<p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</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" title="אַ">אַ</a>
+</p>
+!! end
+
 !! test
 Empty attribute crash test (bug 2067)
 !! input
@@ -4335,7 +4349,7 @@ Bug 2304: HTML attribute safety (dangerous style template; 2309)
 !! input
 <div style="{{dangerous style attribute}}"></div>
 !! result
-<div></div>
+<div style="/* insecure input */"></div>
 
 !! end
 
@@ -4353,7 +4367,7 @@ Bug 2304: HTML attribute safety (unsafe parameter; 2309)
 !! input
 {{div style|width: expression(alert(document.cookie))}}
 !! result
-<div>Magic div</div>
+<div style="/* insecure input */">Magic div</div>
 
 !! end
 
@@ -4462,7 +4476,7 @@ Bug 3244: HTML attribute safety (extension; unsafe)
 !! input
 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
 !! result
-<div></div>
+<div style="/* insecure input */"></div>
 
 !! end
 
@@ -4482,7 +4496,7 @@ MSIE CSS safety test: spurious slash
 !! input
 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
 !! result
-<div>evil</div>
+<div style="/* insecure input */">evil</div>
 
 !! end
 
@@ -4491,7 +4505,7 @@ MSIE CSS safety test: hex code
 !! input
 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
 !! result
-<div>evil</div>
+<div style="/* insecure input */">evil</div>
 
 !! end
 
@@ -4537,11 +4551,28 @@ Table attribute safety
 !! result
 <table>
 <tr>
-<th> status
+<th style="/* insecure input */"> status
 </th></tr></table>
 
 !! end
 
+!! test
+CSS line continuation 1
+!! input
+<div style="background-image: u\&#10;rl(test.jpg);"></div>
+!! result
+<div style="/* insecure input */"></div>
+
+!! end
+
+!! test
+CSS line continuation 2
+!! input
+<div style="background-image: u\&#13;rl(test.jpg); "></div>
+!! result
+<div style="/* insecure input */"></div>
+
+!! end
 
 !! article
 Template:Identity
@@ -4858,7 +4889,7 @@ disabled
 !! input
 <br id=9 />
 !! result
-Something, but defenetly not <br id="9" />...
+Something, but definitely not <br id="9" />...
 !! end
 
 !! test
@@ -4912,7 +4943,7 @@ Punctuation: nbsp before exclamation
 !! input
 C'est grave !
 !! result
-<p>C'est grave&nbsp;!
+<p>C'est grave&#160;!
 </p>
 !! end
 
@@ -5189,7 +5220,10 @@ noxml
 !! result
 <table>
 <tr>
-<th>https://</th><th></th><th></th><th>
+<th>https://</th>
+<th></th>
+<th></th>
+<th>
 </td>
 </tr>
 </table>
@@ -5206,7 +5240,8 @@ Fuzz testing: Parser21
 <table>
 <tr>
 <th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
-</th><td>
+</th>
+<td>
 </td>
 </tr>
 </table>
@@ -5898,6 +5933,22 @@ section=1
 ==marked==
 !!end
 
+# Test behaviour of bug 19910
+!! test
+Sectiion with all-equals
+!! options
+section=2
+!! input
+=== 
+The line above must have a trailing space
+=== <!--
+--> <!-- -->
+But just in case it doesn't...
+!! result
+=== <!--
+--> <!-- -->
+But just in case it doesn't...
+!! end
 
 !! test
 Section replacement test (section 0)
@@ -6438,6 +6489,97 @@ image4    |300px| centre
 
 !! end
 
+!! test
+Gallery (with options)
+!! input
+<gallery widths='60px' 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
+</gallery>
+!! result
+<table class="gallery" cellspacing="0" cellpadding="0">
+       <caption>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></caption>
+       <tr>
+               <td><div class="gallerybox" style="width: 95px;">
+                       <div style="height: 52px;">Nonexistant.jpg</div>
+                       <div class="gallerytext">
+<p>caption
+</p>
+                       </div>
+               </div></td>
+               <td><div class="gallerybox" style="width: 95px;">
+                       <div style="height: 52px;">Nonexistant.jpg</div>
+                       <div class="gallerytext">
+                       </div>
+               </div></td>
+       </tr>
+       <tr>
+               <td><div class="gallerybox" style="width: 95px;">
+                       <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><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>
+                       <div class="gallerytext">
+<p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
+</p>
+                       </div>
+               </div></td>
+               <td><div class="gallerybox" style="width: 95px;">
+                       <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><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>
+                       <div class="gallerytext">
+                       </div>
+               </div></td>
+       </tr>
+</table>
+
+!! end
+
+!! test
+gallery (with showfilename option)
+!! input
+<gallery showfilename>
+File:Nonexistant.jpg|caption
+File:Nonexistant.jpg
+image:foobar.jpg|some '''caption''' [[Main Page]]
+File:Foobar.jpg
+</gallery>
+!! result
+<table class="gallery" cellspacing="0" cellpadding="0">
+       <tr>
+               <td><div class="gallerybox" style="width: 155px;">
+                       <div style="height: 152px;">Nonexistant.jpg</div>
+                       <div class="gallerytext">
+<p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
+caption
+</p>
+                       </div>
+               </div></td>
+               <td><div class="gallerybox" style="width: 155px;">
+                       <div style="height: 152px;">Nonexistant.jpg</div>
+                       <div class="gallerytext">
+<p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
+</p>
+                       </div>
+               </div></td>
+               <td><div class="gallerybox" style="width: 155px;">
+                       <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><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 />
+some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
+</p>
+                       </div>
+               </div></td>
+               <td><div class="gallerybox" style="width: 155px;">
+                       <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><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>
+               </div></td>
+       </tr>
+</table>
+
+!! end
+
 !! test
 HTML Hex character encoding (spells the word "JavaScript")
 !! input
@@ -6484,6 +6626,15 @@ ISBN ISBN 1234567890
 </p>
 !! end
 
+!! test
+Bug 22905: <abbr> followed by ISBN followed by </a>
+!! input
+<abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
+!! result
+<p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a href="http://www.example.com" class="external text" rel="nofollow">example.com</a>
+</p>
+!! end
+
 !! test
 Double RFC
 !! input
@@ -6598,12 +6749,10 @@ disabled
 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
 !! test
 Images with the "|" character in the comment
-!! options
-disabled
 !! input
 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="An external URL" 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>An <a href="http://test/?param1=|left|&amp;param2=|x" class="external text" rel="nofollow">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/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>An <a href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" class="external text" rel="nofollow">external</a> URL</div></div></div>
 
 !!end
 
@@ -6655,12 +6804,14 @@ subpage title=[[Subpage test/L1/L2/L3]]
 !! test
 Parents of subpages, two levels up
 !! options
-disabled
 subpage title=[[Subpage test/L1/L2/L3]]
 !! input
 [[../../|L1]]2
+
+[[../../|L1]]l
 !! result
-<p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>
+<p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
+</p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
 </p>
 !! end
 
@@ -6693,8 +6844,8 @@ Definition list code coverage
 ; title : def
 ;title: def
 !! result
-<dl><dt> title  &nbsp;</dt><dd> def
-</dd><dt> title&nbsp;</dt><dd> def
+<dl><dt> title  &#160;</dt><dd> def
+</dd><dt> title&#160;</dt><dd> def
 </dd><dt>title</dt><dd> def
 </dd></dl>
 
@@ -6869,6 +7020,67 @@ anchorencode
 </p>
 !! end
 
+!! test
+anchorencode trims spaces
+!! input
+{{anchorencode: __pretty__please__}}
+!! result
+<p>pretty_please
+</p>
+!! end
+
+!! test
+anchorencode deals with links
+!! input
+{{anchorencode: [[hello|world]] [[hi]]}}
+!! result
+<p>world_hi
+</p>
+!! end
+
+!! test
+anchorencode deals with templates
+!! input
+{{anchorencode: {{Foo}} }}
+!! result
+<p>FOO
+</p>
+!! end
+
+!! test
+anchorencode encodes like the TOC generator: (bug 18431)
+!! input
+=== _ +:.3A%3A&&amp;]] ===
+{{anchorencode: _ +:.3A%3A&&amp;]] }}
+__NOEDITSECTION__
+!! result
+<h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
+<p>.2B:.3A.253A.26.26.5D.5D
+</p>
+!! end
+
+# Expected output in the following test is not necessarily expected (there
+# should probably be <p> tags inside the <blockquote> in the output) -- it's
+# only testing for well-formedness.
+!! test
+Bug 6200: blockquotes and paragraph formatting
+!! input
+<blockquote>
+foo
+</blockquote>
+
+bar
+
+ baz
+!! result
+<blockquote>
+foo
+</blockquote>
+<p>bar
+</p>
+<pre>baz
+</pre>
+!! end
 
 !! test
 Bug 8293: Use of center tag ruins paragraph formatting
@@ -7104,6 +7316,20 @@ China
 </p>
 !! end
 
+!! test
+Bug 24072: more test on conversion rule for title
+!! options
+language=zh variant=zh-tw showtitle
+!! input
+This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
+This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
+!! result
+Taiwan
+<p>This should be stripped!
+This won't take interferes with the title rule.
+</p>
+!! end
+
 !! test
 Raw output of variant escape tags (R flag)
 !! options
 </p>
 <table>
 <tr>
-<td> 1 </td><td> 2
+<td> 1 </td>
+<td> 2
 </td></tr>
 <tr>
-<td> 3 </td><td> 4
+<td> 3 </td>
+<td> 4
 </td></tr></table>
 <p>y
 </p>
@@ -7357,6 +7585,20 @@ Line two
 
 !! end
 
+!! test
+Nesting tags, paragraphs on lines which begin with <div>
+!! options
+disabled
+!! input
+<div></div><strong>A
+B</strong>
+!! result
+<div></div>
+<p><strong>A
+B</strong>
+</p>
+!! end
+
 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
 !! test
 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
@@ -7713,6 +7955,17 @@ title=[[Main Page]]
 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
 !! end
 
+!! test
+Space normalisation on autocomment (bug 22784)
+!! options
+comment
+title=[[Main Page]]
+!!input
+/* __hello__world__ */
+!! result
+<span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span>
+!! end
+
 !!article
 MediaWiki:bad image list
 !!text
@@ -7738,6 +7991,161 @@ Bar foo
 </p>
 !! end
 
+!! test
+Verify that displaytitle works (bug #22501) no displaytitle
+!! options
+showtitle
+!! config
+wgAllowDisplayTitle=true
+wgRestrictDisplayTitle=false
+!! input
+this is not the the title
+!! result
+Parser test
+<p>this is not the the title
+</p>
+!! end
+
+!! test
+Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
+!! options
+showtitle
+title=[[Screen]]
+!! config
+wgAllowDisplayTitle=true
+wgRestrictDisplayTitle=false
+!! input
+this is not the the title
+{{DISPLAYTITLE:whatever}}
+!! result
+whatever
+<p>this is not the the title
+</p>
+!! end
+
+!! test
+Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
+!! options
+showtitle
+title=[[Screen]]
+!! config
+wgAllowDisplayTitle=true
+wgRestrictDisplayTitle=true
+!! input
+this is not the the title
+{{DISPLAYTITLE:whatever}}
+!! result
+Screen
+<p>this is not the the title
+</p>
+!! end
+
+!! test
+Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
+!! options
+showtitle
+title=[[Screen]]
+!! config
+wgAllowDisplayTitle=true
+wgRestrictDisplayTitle=true
+!! input
+this is not the the title
+{{DISPLAYTITLE:screen}}
+!! result
+screen
+<p>this is not the the title
+</p>
+!! end
+
+!! test
+Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
+!! options
+showtitle
+title=[[Screen]]
+!! config
+wgAllowDisplayTitle=false
+!! input
+this is not the the title
+{{DISPLAYTITLE:screen}}
+!! result
+Screen
+<p>this is not the the title
+<a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
+</p>
+!! end
+
+!! test
+Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
+!! options
+showtitle
+title=[[Screen]]
+!! config
+wgAllowDisplayTitle=false
+!! input
+this is not the the title
+!! result
+Screen
+<p>this is not the the title
+</p>
+!! end
+!! test
+preload: check <noinclude> and <includeonly>
+!! options
+preload
+!! input
+Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
+!! result
+Hello kind world.
+!! end
+!! test
+preload: check <onlyinclude>
+!! options
+preload
+!! input
+Goodbye <onlyinclude>Hello world</onlyinclude>
+!! result
+Hello world
+!! end
+
+!! test
+preload: can pass tags through if we want to
+!! options
+preload
+!! input
+<includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
+!! result
+<includeonly>Hello world</includeonly>
+!! end
+
+!! test
+preload: check that it doesn't try to do tricks
+!! options
+preload
+!! input
+* <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
+!! result
+* <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
+!! end
+
+!! test
+Play a bit with r67090 and bug 3158 
+!! options
+disabled
+!! input
+<div style="width:50% !important">&nbsp;</div>
+<div style="width:50%&nbsp;!important">&nbsp;</div>
+<div style="width:50%&#160;!important">&nbsp;</div>
+<div style="border : solid;">&nbsp;</div>
+!! result
+<div style="width:50% !important">&nbsp;</div>
+<div style="width:50% !important">&nbsp;</div>
+<div style="width:50% !important">&nbsp;</div>
+<div style="border&#160;: solid;">&nbsp;</div>
+
+!! end
+
 
 TODO:
 more images