Merge "Test wiki tables with a lot of comments"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
index bc24236..6025ce1 100644 (file)
@@ -65,6 +65,18 @@ Template:inner list
 * item 1
 !! endarticle
 
+!! article
+Template:tbl-start
+!! text
+{|
+!! endarticle
+
+!! article
+Template:tbl-end
+!! text
+|}
+!! endarticle
+
 !! article
 Template:!
 !! text
@@ -542,7 +554,7 @@ nowiki 3
 ### Comments
 ###
 !! test
-Comments and Pre
+Comments and Indent-Pre
 !! input
 <!-- comment 1 --> asdf
 
@@ -948,7 +960,7 @@ Bug 6200: Preformatted in <blockquote>
 !! 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
@@ -956,7 +968,7 @@ Templates: Pre: 1a. Templates that break a line should suppress <pre>
 !!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}}
@@ -966,7 +978,7 @@ 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}}
@@ -978,7 +990,7 @@ 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
@@ -999,7 +1011,7 @@ c
 !!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}}
 
@@ -1030,7 +1042,7 @@ bar
 !!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
 
@@ -1120,7 +1132,7 @@ Templates: Strip whitespace from named parameters, but not positional ones
 ###
 
 !!test
-1a. Pre and Comments
+1a. Indent-Pre and Comments
 !!input
  a
 <!--a-->
@@ -1133,7 +1145,7 @@ c
 !!end
 
 !!test
-1b. Pre and Comments
+1b. Indent-Pre and Comments
 !!input
  a
  <!--a-->
@@ -1146,7 +1158,7 @@ c
 !!end
 
 !!test
-1c. Pre and Comments
+1c. Indent-Pre and Comments
 !!input
 <!--a-->  a
 
@@ -1159,7 +1171,7 @@ c
 !!end
 
 !!test
-2a. Pre and tables
+2a. Indent-Pre and tables
 !!input
  {|
  |-
@@ -1180,7 +1192,7 @@ c
 !!end
 
 !!test
-2b. Pre and tables
+2b. Indent-Pre and tables
 !!input
   {|
  |-
@@ -1196,7 +1208,7 @@ c
 !!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>
@@ -1209,7 +1221,7 @@ c
 !!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
@@ -1279,6 +1291,80 @@ c
 
 !!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
 ###
@@ -1599,6 +1685,39 @@ Table / list interaction: indented table with lists in table contents
 
 !! 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
@@ -2787,6 +2906,22 @@ Accept empty attributes in td/th cells (td/th cells starting with leading ||)
 
 !! 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
@@ -2990,6 +3125,29 @@ disabled
 
 !! 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
 ###
@@ -3970,6 +4128,20 @@ List interrupted by empty line or heading
 
 !!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
@@ -4926,6 +5098,40 @@ Un-closed <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&lt;/includeonly&gt;
+</td>
+<td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
+</td></tr></table>
+
+!!end
+
 !! article
 Template:Includeonly section
 !! text
@@ -5405,6 +5611,45 @@ Templates: Wiki Tables: 3. td-content via multiple templates
 
 !!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
@@ -5472,7 +5717,7 @@ disabled
 |bar
 |}
 !!result
-<table data-parsoid="{&quot;src&quot;:&quot;{|\n|{{echo|foo&lt;/table&gt;}}\n|bar\n|}&quot;}" 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>
@@ -5504,14 +5749,14 @@ disabled
   </tr>
 </table>
 !!result
-<table data-parsoid="{&quot;src&quot;:&quot;&lt;table&gt;\n  &lt;tr&gt;\n    &lt;td&gt;\n    &lt;table&gt;\n      &lt;tr&gt;\n        &lt;td&gt;1. {{echo|foo &lt;/table&gt;}}&lt;/td&gt;\n        &lt;td&gt; bar &lt;/td&gt;\n        &lt;td&gt;2. {{echo|baz &lt;/table&gt;}}&lt;/td&gt;\n      &lt;/tr&gt;\n      &lt;tr&gt;\n        &lt;td&gt;abc&lt;/td&gt;\n      &lt;/tr&gt;\n    &lt;/table&gt;\n    &lt;/td&gt;\n  &lt;/tr&gt;\n  &lt;tr&gt;\n    &lt;td&gt;xyz&lt;/td&gt;\n  &lt;/tr&gt;\n&lt;/table&gt;&quot;}" about="#mwt1" typeof="mw:Object/Template">
-  <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
-    <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
-    <table data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
-      <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
-        <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">1. foo </td></tr></tbody></table></td>
-        <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}"> bar </td>
-        <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">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">
@@ -7283,6 +7528,10 @@ Namespaced link must have a title (bad fragment version)
 !!end
 
 
+###
+### HTML tags and HTML attributes
+###
+
 !! test
 div with no attributes
 !! input
@@ -7341,6 +7590,18 @@ disabled
 
 !! end
 
+# The PHP parser escapes the opening brace to &#123; 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
@@ -12734,7 +12995,7 @@ disabled
 !! input
 [[Foo|<nowiki>Foo''boo''</nowiki>]]
 !! result
-<a rel="mw:WikiLink" href="Foo" data-parsoid="{&quot;tsr&quot;:[0,7],&quot;contentPos&quot;:[5,5],&quot;src&quot;:&quot;[[Foo]]&quot;,&quot;bsp&quot;:[0,7],&quot;stx&quot;:&quot;simple&quot;}">Foo''boo''</a>
+<a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
 !! end
 
 !! test