* item 1
!! endarticle
+!! article
+Template:tbl-start
+!! text
+{|
+!! endarticle
+
+!! article
+Template:tbl-end
+!! text
+|}
+!! endarticle
+
!! article
Template:!
!! text
### Comments
###
!! test
-Comments and Pre
+Comments and Indent-Pre
!! input
<!-- comment 1 --> asdf
!! 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}}
!!end
!! test
-Templates: Pre: 1f: Wrapping should be based on expanded content
+Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
!! input
{{echo| }}a
###
!!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
-3a. Pre and block tags (single-line html)
+3a. Indent-Pre and block tags (single-line html)
!!input
<p> foo </p>
<div> foo </div>
!!end
!!test
-3b. Pre and block tags (pre-content on separate line)
+3b. Indent-Pre and block tags (pre-content on separate line)
!!input
<p>
foo
!!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
###
!! 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
!! 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, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
!!input
!! 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
###
!!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
!! 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
!!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
|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
+###
+### HTML tags and HTML attributes
+###
+
!! test
div with no attributes
!! input
!! 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
!! 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