!! endarticle
!! article
-Template:!
+Template:pipe
!! text
|
!! endarticle
* item 1
!! endarticle
+!! article
+Template:tbl-start
+!! text
+{|
+!! endarticle
+
+!! article
+Template:tbl-end
+!! text
+|}
+!! endarticle
+
+!! article
+Template:!
+!! text
+|
+!! endarticle
+
!! article
Template:echo
!! text
{{{1}}}="{{{2}}}"
!! endarticle
+!! article
+Template:table_attribs
+!! text
+<noinclude>
+|</noinclude>style="color: red"| Foo
+!! endarticle
+
+!! article
+A?b
+!! text
+Weirdo titles!
+!! endarticle
+
###
### Basic tests
###
### Comments
###
!! test
-Comments and Pre
+Comments and Indent-Pre
!! input
<!-- comment 1 --> asdf
</pre>
!! end
+!! test
+Ident preformatting with inline content
+!! input
+ a
+ ''b''
+!! result
+<pre>a
+<i>b</i>
+</pre>
+!! end
+
!! test
<pre> with <nowiki> inside (compatibility with 1.6 and earlier)
!! input
</p>
!! end
+!! test
+</pre> inside nowiki
+!! input
+<nowiki></pre></nowiki>
+!! result
+<p></pre>
+</p>
+!! end
+
!!test
-Templates: Pre: 1a. Templates that break a line should suppress <pre>
+Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
!!input
{{echo|}}
!!result
!!end
!!test
-Templates: Pre: 1b. Templates that break a line should suppress <pre>
+Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
!!input
{{echo|
foo}}
!!end
!! test
-Templates: Pre: 1c: Wrapping should be based on expanded content
+Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
!! input
{{echo|a
b}}
!!end
!! test
-Templates: Pre: 1d: Wrapping should be based on expanded content
+Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
!! input
{{echo|a
b
!!end
!!test
-Templates: Pre: 1e. Wrapping should be based on expanded content
+Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
!!input
{{echo| foo}}
+{{echo| foo}}{{echo| bar}}
+
{{echo| foo}}
{{echo| bar}}
!!result
<pre>foo
</pre>
+<pre>foo bar
+</pre>
<pre>foo
bar
</pre>
</pre>
!!end
+!! test
+Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
+!! input
+{{echo| }}a
+
+{{echo|
+ }}a
+
+{{echo|
+ b}}
+
+{{echo|a
+ }}b
+
+{{echo|a
+}} b
+!!result
+<pre>a
+</pre>
+<p><br />
+</p>
+<pre>a
+</pre>
+<p><br />
+</p>
+<pre>b
+</pre>
+<p>a
+</p>
+<pre>b
+</pre>
+<p>a
+</p>
+<pre>b
+</pre>
+!!end
+
+!! test
+Templates: Single-line variant of parameter whitespace stripping test
+!! input
+{{echo| a}}
+
+{{echo|1= a}}
+
+{{echo|{{echo| a}}}}
+
+{{echo|1={{echo| a}}}}
+!! result
+<pre>a
+</pre>
+<p>a
+</p>
+<pre>a
+</pre>
+<p>a
+</p>
+!! end
+
+!! test
+Templates: Strip whitespace from named parameters, but not positional ones
+!! input
+{{echo|
+ foo}}
+
+{{echo|
+* foo}}
+
+{{echo| 1 =
+ foo}}
+
+{{echo| 1 =
+* foo}}
+!! result
+<pre>foo
+</pre>
+<p><br />
+</p>
+<ul><li> foo
+</li></ul>
+<p>foo
+</p>
+<ul><li> foo
+</li></ul>
+
+!! end
+
###
### Parsoid-centric tests for testing RT edge cases for pre
###
!!test
-1a. Pre and Comments
+1a. Indent-Pre and Comments
!!input
a
<!--a-->
!!end
!!test
-1b. Pre and Comments
+1b. Indent-Pre and Comments
!!input
a
<!--a-->
!!end
!!test
-1c. Pre and Comments
+1c. Indent-Pre and Comments
!!input
<!--a--> a
!!end
!!test
-2a. Pre and tables
+2a. Indent-Pre and tables
!!input
{|
|-
!!end
!!test
-2b. Pre and tables
+2b. Indent-Pre and tables
!!input
{|
|-
!!end
!!test
-3. Pre and block tags
+3a. Indent-Pre and block tags (single-line html)
!!input
<p> foo </p>
<div> foo </div>
</pre>
!!end
+!!test
+3b. Indent-Pre and block tags (pre-content on separate line)
+!!input
+<p>
+ foo
+</p>
+
+<div>
+ foo
+</div>
+
+<center>
+ foo
+</center>
+
+<blockquote>
+ foo
+</blockquote>
+
+<table><tr><td>
+ foo
+</td></tr></table>
+
+<ul><li>
+ foo
+</li></ul>
+
+!!result
+<p>
+ foo
+</p>
+<div>
+<pre>foo
+</pre>
+</div>
+<center>
+<pre>foo
+</pre>
+</center>
+<blockquote>
+ foo
+</blockquote>
+<table><tr><td>
+<pre>foo
+</pre>
+</td></tr></table>
+<ul><li>
+ foo
+</li></ul>
+
+!!end
+
!!test
4. Multiple spaces at start-of-line
!!input
!!end
+###
+### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
+###
+
+!!test
+HTML-pre: 1. embedded newlines
+!!input
+<pre>foo</pre>
+
+<pre>
+foo
+</pre>
+
+<pre>
+
+foo
+</pre>
+
+<pre>
+
+
+foo
+</pre>
+!!result
+<pre>foo</pre>
+<pre>
+foo
+</pre>
+<pre>
+
+foo
+</pre>
+<pre>
+
+
+foo
+</pre>
+
+!!end
+
+!!test
+HTML-pre: 2: indented text
+!!input
+<pre>
+ foo
+</pre>
+!!result
+<pre>
+ foo
+</pre>
+
+!!end
+
+!!test
+HTML-pre: 3: other wikitext
+!!input
+<pre>
+* foo
+# bar
+= no-h =
+'' no-italic ''
+[[ NoLink ]]
+</pre>
+!!result
+<pre>
+* foo
+# bar
+= no-h =
+'' no-italic ''
+[[ NoLink ]]
+</pre>
+
+!!end
+
###
### Definition lists
###
Definition and unordered list using wiki syntax nested in unordered list using html tags.
!! input
<ul><li>
-; term : description
+; term : description
* unordered
</li>
</ul>
!! result
<ul><li>
-<dl><dt> term </dt><dd> description
+<dl><dt> term </dt><dd> description
</dd></dl>
<ul><li> unordered
</li></ul>
## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
+!! test
+Table / list interaction: indented table with lists in table contents
+!! input
+:{|
+|-
+| a
+* b
+|-
+| c
+* d
+|}
+!! result
+<dl><dd><table>
+
+<tr>
+<td> a
+<ul><li> b
+</li></ul>
+</td></tr>
+<tr>
+<td> c
+<ul><li> d
+</li></ul>
+</td></tr></table></dd></dl>
+
+!! end
+
+!!test
+Table / list interaction: lists nested in tables nested in indented lists
+!!input
+:{|
+|
+:a
+:b
+|
+*c
+*d
+|}
+
+*e
+*f
+!!result
+<dl><dd><table>
+<tr>
+<td>
+<dl><dd>a
+</dd><dd>b
+</dd></dl>
+</td>
+<td>
+<ul><li>c
+</li><li>d
+</li></ul>
+</td></tr></table></dd></dl>
+<ul><li>e
+</li><li>f
+</li></ul>
+
+!!end
+
!! test
Definition Lists: Nesting: Multi-level (Parsoid only)
!! options
</p>
!! end
+!! test
+Bracketed external links with template-generated invalid target
+!! input
+[{{echo|http:/example.com}} title]
+!! result
+<p>[http:/example.com title]
+</p>
+!! end
+
!! test
Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
!! input
</p>
!! end
+!! test
+Non-extlinks in brackets
+!! input
+[foo]
+[foo bar]
+[foo ''bar'']
+[fool's] errand
+[fool's errand]
+[{{echo|foo}}]
+[{{echo|foo}} bar]
+[{{echo|foo}} ''bar'']
+[{{echo|foo}}l's] errand
+[{{echo|foo}}l's errand]
+!! result
+<p>[foo]
+[foo bar]
+[foo <i>bar</i>]
+[fool's] errand
+[fool's errand]
+[foo]
+[foo bar]
+[foo <i>bar</i>]
+[fool's] errand
+[fool's errand]
+</p>
+!! end
+
###
### Quotes
###
!! end
+!! test
+Table td-cell syntax variations
+!! input
+{|
+| foo bar foo | baz
+| foo bar foo || baz
+| style='color:red;' | baz
+| style='color:red;' || baz
+|}
+!! result
+<table>
+<tr>
+<td> baz
+</td>
+<td> foo bar foo </td>
+<td> baz
+</td>
+<td style="color:red;"> baz
+</td>
+<td> style='color:red;' </td>
+<td> baz
+</td></tr></table>
+
+!! end
+
!! test
Simple table
!! input
-{|
+{|
| 1 || 2
-|-
+|-
| 3 || 4
|}
!! result
!! test
Simple table but with multiple dashes for row wikitext
!! input
-{|
+{|
| foo
|-----
| bar
!! end
+!! test
+Accept "||" in table headings
+!! input
+{|
+!h1 || h2
+|}
+!! result
+<table>
+<tr>
+<th>h1 </th>
+<th> h2
+</th></tr></table>
+
+!! end
+
+!! test
+Accept "||" in indented table headings
+!! input
+:{|
+!h1 || h2
+|}
+!! result
+<dl><dd><table>
+<tr>
+<th>h1 </th>
+<th> h2
+</th></tr></table></dd></dl>
+
+!! end
+
+!! test
+Accept empty attributes in td/th cells (td/th cells starting with leading ||)
+!! input
+{|
+!| h1
+|| a
+|}
+!! result
+<table>
+<tr>
+<th> h1
+</th>
+<td> a
+</td></tr></table>
+
+!! end
+
+!!test
+Accept "| !" at start of line in tables (ignore !-attribute)
+!!input
+{|
+|-
+| !style="color:red" | bar
+|}
+!!result
+<table>
+
+<tr>
+<td> bar
+</td></tr></table>
+
+!!end
+
!!test
-Allow +/- in 2nd and later cells in a row
+Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
!!input
{|
+|-
+|style='color:red;'|+1
+|style='color:blue;'|-1
+|-
| 1 || 2 || 3
+| 1 ||+2 ||-3
|-
-| 1 || +2 || -3
+| +1
+| -1
|}
!!result
<table>
+
+<tr>
+<td style="color:red;">+1
+</td>
+<td style="color:blue;">-1
+</td></tr>
<tr>
<td> 1 </td>
<td> 2 </td>
<td> 3
+</td>
+<td> 1 </td>
+<td>+2 </td>
+<td>-3
</td></tr>
<tr>
-<td> 1 </td>
-<td> +2 </td>
-<td> -3
+<td> +1
+</td>
+<td> -1
</td></tr></table>
!!end
Table rowspan
!! input
{| border=1
-| Cell 1, row 1
-|rowspan=2| Cell 2, row 1 (and 2)
-| Cell 3, row 1
-|-
-| Cell 1, row 2
-| Cell 3, row 2
+| Cell 1, row 1
+|rowspan=2| Cell 2, row 1 (and 2)
+| Cell 3, row 1
+|-
+| Cell 1, row 2
+| Cell 3, row 2
|}
!! result
<table border="1">
!! end
+!! test
+Template-generated table cell attributes and cell content
+!! input
+{|
+|{{table_attribs}}
+|}
+!! result
+<table>
+<tr>
+<td style="color: red"> Foo
+</td></tr></table>
+
+!! end
+
+!! test
+Table with row followed by newlines and table heading
+!! input
+{|
+|-
+
+! foo
+|}
+!! result
+<table>
+
+
+<tr>
+<th> foo
+</th></tr></table>
+
+!! end
+
+# FIXME: Preserve the attribute properly (with an empty string as value) in
+# the PHP parser. Parsoid implements the behavior below.
+!! test
+Table attributes with empty value
+!! options
+disabled
+!! input
+{|
+| style=| hello
+|}
+!! result
+<table>
+<tr>
+<td style=""> hello
+</td></tr></table>
+
+!! end
+
+!! test
+Wikitext table with a lot of comments
+!! input
+{|
+<!-- c0 -->
+| foo
+<!-- c1 -->
+|- <!-- c2 -->
+<!-- c3 -->
+|<!-- c4 -->
+<!-- c5 -->
+|}
+!! result
+<table>
+<tr>
+<td> foo
+</td></tr>
+<tr>
+<td>
+</td></tr></table>
+
+!! end
###
### Internal links
</p>
!! end
+!! test
+Link with HTML entity in suffix / tail
+!! input
+[[Main Page]]", [[Main Page]]a
+!! result
+<p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>", <a href="/wiki/Main_Page" title="Main Page">Main Page</a>a
+</p>
+!! end
+
!! test
Link with 3 brackets
!! input
!! test
Plain link to protocol-relative URL with link text
!! input
-[[//www.example.com Link text]]
+[[//www.example.com Link text]]
+!! result
+<p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
+</p>
+!! end
+
+!! test
+Plain link to page with question mark in title
+!! input
+[[A?b]]
+
+[[A?b|Baz]]
!! result
-<p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
+<p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
+</p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
</p>
!! end
</p>
!! end
+!! test
+Broken br tag sanitization
+!! input
+</br>
+!! result
+<p></br>
+</p>
+!! end
+
!! test
Incorrecly removing closing slashes from correctly formed XHTML
!! input
</p>
!! end
+!! test
+Horizontal ruler -- Supports content following dashes on same line
+!! input
+---- Foo
+!! result
+<hr /> Foo
+
+!! end
+
###
### Block-level elements
###
!!end
+!!test
+Multiple list tags generated by templates
+!!input
+{{echo|<li>}}a
+{{echo|<li>}}b
+{{echo|<li>}}c
+!!result
+<li>a
+<li>b
+<li>c</li>
+</li>
+</li>
+
+!!end
###
### Magic Words
</p>
!! end
+!! test
+Template with invalid target containing tags
+!! input
+{{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
+!! result
+<p>{{a<b>b</b>|foo|a=b|a = b}}
+</p>
+!! end
+
+!! test
+Template with invalid target containing unclosed tag
+!! input
+{{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
+!! result
+<p>{{a<b>|foo|a=b|a = b}}</b>
+</p>
+!! end
+
!! article
Template:test
!! text
!! test
BUG 553: link with two variables in a piped link
!! input
-{|
+{|
|[[{{{1}}}|{{{2}}}]]
|}
!! result
!! article
Template:table
!! text
-{|
+{|
| 1 || 2
-|-
+|-
| 3 || 4
|}
!! endarticle
</p>
!! end
+!! test
+Template with targets containing wikilinks
+!! input
+{{[[foo]]}}
+
+{{[[{{echo|foo}}]]}}
+
+{{{{echo|[[foo}}]]}}
+!! result
+<p>{{<a href="/index.php?title=Foo&action=edit&redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
+</p><p>{{<a href="/index.php?title=Foo&action=edit&redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
+</p><p>{{[[foo}}]]
+</p>
+!! end
!! article
Template:MSGNW test
</p>
!! end
+!! test
+Un-closed <noinclude>
+!! input
+<noinclude>
+!! result
+!! end
+
!! test
<onlyinclude> on a page
!! input
</p>
!! end
+!! test
+Un-closed <onlyinclude>
+!! input
+<onlyinclude>
+!! result
+!! end
+
+!!test
+Self-closed noinclude, includeonly, onlyinclude tags
+!!input
+<noinclude />
+<includeonly />
+<onlyinclude />
+!!result
+<p><br />
+</p>
+!!end
+
+!!test
+Unbalanced includeonly and noinclude tags
+!!input
+{|
+|a</noinclude>
+|b</noinclude></noinclude>
+|c</noinclude></includeonly>
+|d</includeonly></includeonly>
+|}
+!!result
+<table>
+<tr>
+<td>a
+</td>
+<td>b
+</td>
+<td>c</includeonly>
+</td>
+<td>d</includeonly></includeonly>
+</td></tr></table>
+
+!!end
+
!! article
Template:Includeonly section
!! text
==Section 1==
!! end
+!! test
+Un-closed <includeonly>
+!! input
+<includeonly>
+!! result
+!! end
+
###
### <includeonly> and <noinclude> in attributes
###
!!end
!!test
-Templates: Tables: 1. Generating start of a HTML table
+Templates: HTML Tables: 1. Generating start of a HTML table
!!input
{{echo|<table><tr><td>foo</td>}}</tr></table>
!!result
!!end
!!test
-Templates: Tables: 2a. Generating middle of a HTML table
+Templates: HTML Tables: 2a. Generating middle of a HTML table
!!input
<table><tr>{{echo|<td>foo</td>}}</tr></table>
!!result
!!end
!!test
-Templates: Tables: 2b. Generating middle of a HTML table
+Templates: HTML Tables: 2b. Generating middle of a HTML table
!!input
<table>{{echo|<tr><td>foo</td></tr>}}</table>
!!result
!!end
!!test
-Templates: Tables: 3. Generating end of a HTML table
+Templates: HTML Tables: 3. Generating end of a HTML table
!!input
<table><tr>{{echo|<td>foo</td></tr></table>}}
!!result
!!end
!!test
-Templates: Tables: 4a. Generating a single tag of a HTML table
+Templates: HTML Tables: 4a. Generating a single tag of a HTML table
!!input
{{echo|<table>}}<tr><td>foo</td></tr></table>
!!result
!!end
!!test
-Templates: Tables: 4b. Generating a single tag of a HTML table
+Templates: HTML Tables: 4b. Generating a single tag of a HTML table
!!input
<table>{{echo|<tr>}}<td>foo</td></tr></table>
!!result
!!end
!!test
-Templates: Tables: 4c. Generating a single tag of a HTML table
+Templates: HTML Tables: 4c. Generating a single tag of a HTML table
!!input
<table><tr>{{echo|<td>}}foo</td></tr></table>
!!result
!!end
!!test
-Templates: Tables: 4d. Generating a single tag of a HTML table
+Templates: HTML Tables: 4d. Generating a single tag of a HTML table
!!input
<table><tr><td>foo{{echo|</td>}}</tr></table>
!!result
!!end
!!test
-Templates: Tables: 4e. Generating a single tag of a HTML table
+Templates: HTML Tables: 4e. Generating a single tag of a HTML table
!!input
<table><tr><td>foo</td>{{echo|</tr>}}</table>
!!result
!!end
!!test
-Templates: Tables: 4f. Generating a single tag of a HTML table
+Templates: HTML Tables: 4f. Generating a single tag of a HTML table
!!input
<table><tr><td>foo</td></tr>{{echo|</table>}}
!!result
!!end
+!!test
+Templates: Wiki Tables: 1. Fostering of entire template content
+!!input
+{|
+{{echo|a}}
+|}
+!!result
+<table>
+a
+<tr><td></td></tr></table>
+
+!!end
+
+!!test
+Templates: Wiki Tables: 2. Fostering of partial template content
+!!input
+{|
+{{echo|a
+<div>b</div>}}
+|}
+!!result
+<table>
+a
+<div>b</div>
+<tr><td></td></tr></table>
+
+!!end
+
+!!test
+Templates: Wiki Tables: 3. td-content via multiple templates
+!!input
+{|
+{{echo|{{pipe}}a}}{{echo|b}}
+|}
+!!result
+<table>
+<tr>
+<td>ab
+</td></tr></table>
+
+!!end
+
+!!test
+Templates: Wiki Tables: 4. Templated tags, no content
+!!input
+{{tbl-start}}
+{{tbl-end}}
+!!result
+<table>
+<tr><td></td></tr></table>
+
+!!end
+
+!!test
+Templates: Wiki Tables: 4. Templated tags, regular td-tags
+!!input
+{{tbl-start}}
+|foo
+{{tbl-end}}
+!!result
+<table>
+<tr>
+<td>foo
+</td></tr></table>
+
+!!end
+
+!!test
+Templates: Wiki Tables: 4. Templated tags, templated td-tags
+!!input
+{{tbl-start}}
+{{!}}foo
+{{tbl-end}}
+!!result
+<table>
+<tr>
+<td>foo
+</td></tr></table>
+
+!!end
+
+!!test
+Templates: Lists: Multi-line list-items via templates
+!!input
+*{{echo|a {{nonexistent|
+unused}}}}
+*{{echo|b {{nonexistent|
+unused}}}}
+!!result
+<ul><li>a <a href="/index.php?title=Template:Nonexistent&action=edit&redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
+</li><li>b <a href="/index.php?title=Template:Nonexistent&action=edit&redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
+</li></ul>
+
+!!end
+
!!test
Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
!!input
|bar
|}
!!result
-<table data-parsoid="{"src":"{|\n|{{echo|foo</table>}}\n|bar\n|}"}" about="#mwt1" typeof="mw:Object/Template ">
+<table about="#mwt1" typeof="mw:Object/Template ">
<tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
bar</span><span about="#mwt1">
</span>
</tr>
</table>
!!result
-<table data-parsoid="{"src":"<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. {{echo|foo </table>}}</td>\n <td> bar </td>\n <td>2. {{echo|baz </table>}}</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"}" about="#mwt1" typeof="mw:Object/Template">
- <tbody><tr data-parsoid="{"stx":"html"}">
- <td data-parsoid="{"stx":"html"}">
- <table data-parsoid="{"stx":"html"}">
- <tbody><tr data-parsoid="{"stx":"html"}">
- <td data-parsoid="{"stx":"html"}">1. foo </td></tr></tbody></table></td>
- <td data-parsoid="{"stx":"html"}"> bar </td>
- <td data-parsoid="{"stx":"html"}">2. baz </td></tr></tbody></table><span about="#mwt1">
+<table about="#mwt1" typeof="mw:Object/Template">
+ <tbody><tr >
+ <td >
+ <table >
+ <tbody><tr >
+ <td >1. foo </td></tr></tbody></table></td>
+ <td > bar </td>
+ <td >2. baz </td></tr></tbody></table><span about="#mwt1">
</span><span about="#mwt1">
abc</span><span about="#mwt1">
!! end
+!! test
+Image with width attribute at different positions
+!! input
+[[Image:foobar.jpg|200px|right|Caption]]
+[[Image:foobar.jpg|right|200px|Caption]]
+[[Image:foobar.jpg|right|Caption|200px]]
+!! result
+<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
+<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
+<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
+
+!! end
+
!! test
Image with link parameter, wiki target
!! input
!!end
+###
+### HTML tags and HTML attributes
+###
+
!! test
div with no attributes
!! input
!!end
+# FIXME: produce empty string instead of "class" in the PHP parser, following
+# the HTML5 spec.
+!! test
+div with empty attribute value, space before equals
+!! options
+disabled
+!! input
+<div class =>HTML rocks</div>
+!! result
+<div class="">HTML rocks</div>
+
+!! end
+
+# The PHP parser escapes the opening brace to { for some reason, so
+# disabled this test for it.
+!! test
+div with braces in attribute value
+!! options
+disabled
+!! input
+<div title="{}">Foo</div>
+!! result
+<div title="{}">Foo</div>
+!! end
+
+# This it very inconsistent in the PHP parser: it returns
+# class="class" if there is a space between the name and the equal sign (see
+# 'div with empty attribute value, space before equals'), but strips the
+# attribute completely if the space is missing. We hope that not much content
+# depends on this, so are implementing the behavior below in Parsoid for
+# consistencies' sake. Disabled for the PHP parser.
+# FIXME: fix this behavior in the PHP parser?
+!! test
+div with empty attribute value, no space before equals
+!! options
+disabled
+!! input
+<div class=>HTML rocks</div>
+!! result
+<div class="">HTML rocks</div>
+
+!! end
+
!! test
HTML multiple attributes correction
!! input
!!end
+!! test
+Non-ASCII pseudo-tags are rendered as text
+!! input
+<khyô>
+!! result
+<p><khyô>
+</p>
+!! end
+
+!! test
+Pseudo-tag with URL 'name' renders as url link
+!! input
+<http://example.com/>
+!! result
+<p><<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>>
+</p>
+!! end
!! test
text with amp in the middle of nowhere
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">
+ <meta itemprop="hello" http-equiv="refresh" content="5">
+ <link itemprop="hello" href="{{SERVER}}">
+ <link rel="stylesheet" href="{{SERVER}}">
+ <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
+</div>
+!! result
+<div itemscope="itemscope">
+<p> <meta itemprop="hello" content="world" />
+ <meta http-equiv="refresh" content="5">
+ <meta itemprop="hello" content="5" />
+</p>
+ <link itemprop="hello" href="http://Britney-Spears" />
+ <link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>">
+ <link itemprop="hello" href="http://Britney-Spears" />
+</div>
+
+!! end
+
!! test
Language converter: output gets cut off unexpectedly (bug 5757)
!! options
</p>
!! end
+!! test
+Proper conversion of text in external links
+!! options
+language=sr variant=sr-ec
+!! input
+http://www.google.com
+gopher://www.google.com
+[http://www.google.com http://www.google.com]
+[gopher://www.google.com gopher://www.google.com]
+[https://www.google.com irc://www.google.com]
+[ftp://www.google.com www.google.com/ftp://dir]
+[//www.google.com www.google.com]
+!! result
+<p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
+<a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
+<a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
+<a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
+<a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
+<a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
+<a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
+</p>
+!! end
+
!! test
Do not convert roman numbers to language variants
!! options
!! end
+# Plain MediaWiki does not remove empty lists, but tidy actually does.
+# Templates in Wikipedia rely on this behavior, as tidy has always been
+# enabled there. These tests are normally run *without* tidy, so specify the
+# full output here.
+# To test realistic parsing behavior, apply a tidy-like transformation to both
+# the expected output and your parser's output.
+!! test
+Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
+!! input
+******* Foo {{bullet}}
+!! result
+<ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
+</li></ul>
+</li></ul>
+</li></ul>
+</li></ul>
+</li></ul>
+</li></ul>
+</li><li> Bar
+</li></ul>
+
+!! end
+
!! test
Bug 529: Uncovered table already at line-start
!! input
</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
!!end
!! test
-Headings: 1. Nested inside html
+Headings: 1. Nested inside html
!! options
disabled
!! input
!!end
!! test
-Headings: 3. Nested inside html with wikitext split by html tags
+Headings: 3. Nested inside html with wikitext split by html tags
!! options
disabled
!! input
#### ----------------------------------------
!! test
-Lists: 0. Outside nests
+Lists: 0. Outside nests
!! input
<nowiki>*foo</nowiki>
!!end
!! test
-Lists: 7. Escape bullets in a multi-line context
+Lists: 7. Escape bullets in a multi-line context
!! input
<nowiki>a
*b</nowiki>
#### -----------------------------------
!! test
-HRs: 1. Single line
+HRs: 1. Single line
!! options
disabled
!! input
!! input
[[Foo|<nowiki>Foo''boo''</nowiki>]]
!! result
-<a rel="mw:WikiLink" href="Foo" data-parsoid="{"tsr":[0,7],"contentPos":[5,5],"src":"[[Foo]]","bsp":[0,7],"stx":"simple"}">Foo''boo''</a>
+<a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
!! end
!! test
!! test
2. Link fragments inside <i> and <b>
-(FIXME: Escaping one or both of [[ and ]] is also acceptable --
+(FIXME: Escaping one or both of [[ and ]] is also acceptable --
this is one of the shortcomings of this format)
!! input
''[[foo''<nowiki>]]</nowiki>
</p>
!! end
+!! test
+Tag-like HTML structures are passed through as text
+!! input
+<x y>
+
+<x.y>
+
+<x-y>
+
+1>2
+
+x<y
+
+a>b
+
+1<d e>f
+!! result
+<p><x y>
+</p><p><x.y>
+</p><p><x-y>
+</p><p>1>2
+</p><p>x<y
+</p><p>a>b
+</p><p>1<d e>f
+</p>
+!! end
+
+
+# This fails in the PHP parser (see bug 40670,
+# https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
+!! test
+Tag names followed by punctuation should not be recognized as tags
+!! options
+disabled
+!! input
+<s.ome> text
+!! result
+<p><s.ome> text
+</p>
+!! end
+
+
TODO:
more images
more tables