Update outdated references to maintenance/ in documentation comments.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
index ce5e9f8..6a1993d 100644 (file)
 # comment       run through Linker::formatComment() instead of main parser
 # local         format section links in edit comment text as local links
 #
+# You can also set the following parser properties via test options:
+#  wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
+#  wgLinkHolderBatchSize, wgRawHtml
+#
 # For testing purposes, temporary articles can created:
 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
 # where '/' denotes a newline.
@@ -116,6 +120,19 @@ Template:table_attribs
 |</noinclude>style="color: red"| Foo
 !! endarticle
 
+!! article
+Template:table_cells
+!! text
+{{table_attribs}} || Bar || Baz
+!! endarticle
+
+!! article
+Template:image_attribs
+!! text
+<noinclude>
+[[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
+!! endarticle
+
 !! article
 A?b
 !! text
@@ -848,6 +865,37 @@ Non-html5 tags should be accepted
 </p>
 !! end
 
+!! test
+<wbr> isn't (yet) valid wikitext (bug 52468)
+!! input
+<wbr>
+!! result
+<p>&lt;wbr&gt;
+</p>
+!! end
+
+###
+### Special characters
+###
+
+!! test
+Bare pipe character (bug 52363)
+!! input
+|
+!! result
+<p>|
+</p>
+!! end
+
+!! test
+Bare pipe character from a template (bug 52363)
+!! input
+{{pipe}}
+!! result
+<p>|
+</p>
+!! end
+
 ###
 ### <nowiki> test cases
 ###
@@ -1106,7 +1154,7 @@ b
 !! end
 
 ###
-### paragraph wraping tests
+### paragraph wrapping tests
 ###
 !! test
 No block tags
@@ -1605,8 +1653,13 @@ Templates: Dont escape already nowiki-escaped text in template parameters
 parsoid=html2wt,wt2wt
 !! input
 {{echo|foo<nowiki>|</nowiki>bar}}
+{{echo|<nowiki>&lt;div&gt;</nowiki>}}
+{{echo|<nowiki></nowiki>}}
 !! result
-<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'>foo<span typeof="mw:Nowiki" data-parsoid="{}">|</span>bar</p>
+<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
+<span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
+<span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
+</p>
 !! end
 
 ###
@@ -2751,6 +2804,17 @@ External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
 </p>
 !! end
 
+!! test
+External image (when not allowed)
+!! options
+wgAllowExternalImages=0
+!! input
+External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
+!! result
+<p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
+</p>
+!! end
+
 !! test
 Link to non-http image, no img tag
 !! input
@@ -3835,6 +3899,36 @@ Template-generated table cell attributes and cell content
 
 !! end
 
+!! test
+Template-generated table cell attributes and cell content (2)
+!! input
+{|
+|align=center {{table_attribs}}
+|}
+!! result
+<table>
+<tr>
+<td align="center" style="color: red"> Foo
+</td></tr></table>
+
+!! end
+
+!! test
+Template-generated table cell attributes and cell content (3)
+!! input
+{|
+|align=center {{table_cells}}
+|}
+!! result
+<table>
+<tr>
+<td align="center" style="color: red"> Foo </td>
+<td> Bar </td>
+<td> Baz
+</td></tr></table>
+
+!! end
+
 !! test
 Table with row followed by newlines and table heading
 !! input
@@ -4792,6 +4886,7 @@ parsoid
 !! result
 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
 !! end
+
 ##
 ## XHTML tidiness
 ###
@@ -4807,6 +4902,8 @@ parsoid
 
 !! test
 Broken br tag sanitization
+!! options
+php
 !! input
 </br>
 !! result
@@ -4814,6 +4911,17 @@ Broken br tag sanitization
 </p>
 !! end
 
+# TODO: Fix html2html mode (bug 51055)!
+!! test
+Parsoid: Broken br tag recognition
+!! options
+parsoid=wt2html
+!! input
+</br>
+!! result
+<p><br></p>
+!! end
+
 !! test
 Incorrecly removing closing slashes from correctly formed XHTML
 !! input
@@ -5154,73 +5262,6 @@ Nested lists 8 (multiple nesting transitions)
 
 !! end
 
-!! test
-Unbalanced closing block tags break a list
-(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
-!! options
-parsoid
-!! input
-<div>
-*a</div><div>
-*b</div>
-!! result
-<div>
-<ul><li>a
-</li></ul></div><div>
-<ul><li>b
-</li></ul></div>
-!! end
-
-!! test
-Unbalanced closing non-block tags don't break a list
-(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
-!! options
-parsoid
-!! input
-<span>
-*a</span><span>
-*b</span>
-!! result
-<p><span></span>
-</p>
-<ul><li>a<span></span>
-</li><li>b
-</li></ul>
-!! end
-
-!! test
-Unclosed formatting tags that straddle lists are closed and reopened
-(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
-!! options
-parsoid
-!! input
-# <s> a
-# b </s>
-!! result
-<ol><li> <s> a </s>
-</li><li> <s> b </s>
-</li></ol>
-!! end
-
-!!test
-List embedded in a non-block tag
-(Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
-!! options
-parsoid
-!!input
-<small>
-* foo
-</small>
-!!result
-<p><small></small></p>
-<small>
-<ul>
-<li> foo</li>
-</ul>
-</small>
-<p><small></small></p>
-!!end
-
 !! test
 List items are not parsed correctly following a <pre> block (bug 785)
 !! input
@@ -5362,6 +5403,77 @@ parsoid
 <ol><li> foo<ol><li> bar</li></ol></li></ol><ul><li> foo<ul><li> bar</li></ul></li></ul><dl><dd> foo<dl><dd> bar</dd></dl></dd></dl>
 !! end
 
+# ------------------------------------------------------------------------
+# The next set of tests are about Parsoid's ability to handle badly nested
+# tags (parse, minimize scope of fixup, and roundtrip back)
+# ------------------------------------------------------------------------
+
+!! test
+Unbalanced closing block tags break a list
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
+!! options
+parsoid
+!! input
+<div>
+*a</div><div>
+*b</div>
+!! result
+<div>
+<ul><li>a
+</li></ul></div><div>
+<ul><li>b
+</li></ul></div>
+!! end
+
+!! test
+Unbalanced closing non-block tags don't break a list
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
+!! options
+parsoid
+!! input
+<span>
+*a</span><span>
+*b</span>
+!! result
+<p><span></span>
+</p>
+<ul><li>a<span></span>
+</li><li>b
+</li></ul>
+!! end
+
+!! test
+Unclosed formatting tags that straddle lists are closed and reopened
+(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
+!! options
+parsoid
+!! input
+# <s> a
+# b </s>
+!! result
+<ol><li> <s> a </s>
+</li><li> <s> b </s>
+</li></ol>
+!! end
+
+!!test
+List embedded in a non-block tag
+(Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
+!! options
+parsoid
+!!input
+<small>
+* foo
+</small>
+!!result
+<p><small></small></p>
+<small>
+<ul>
+<li> foo</li>
+</ul>
+</small>
+<p><small></small></p>
+!!end
 
 ###
 ### Magic Words
@@ -6453,6 +6565,34 @@ Un-closed <includeonly>
 !! result
 !! end
 
+# TODO: test with DOM fragment reuse!
+!! test
+Parsoid: DOM fragment reuse
+!! options
+parsoid=wt2wt,wt2html
+!! input
+a{{echo|b<table></table>c}}d
+
+a{{echo|b
+<table></table>
+c}}d
+
+{{echo|a
+
+<table></table>
+
+b}}
+!! result
+a<span typeof="mw:Transclusion">b</span>
+<table></table><span>c</span>d
+<p typeof="mw:Transclusion">ab</p>
+<table></table>
+<p>cd</p>
+<p typeof="mw:Transclusion">a</p>
+<table></table>
+<p>b</p>
+!! end
+
 ###
 ### <includeonly> and <noinclude> in attributes
 ###
@@ -7656,6 +7796,62 @@ But not inside includeonly
 <includeonly>{{subst:Foo}}</includeonly>
 !! end
 
+!! test
+Parsoid: Recognize nowiki with trailing space in tags
+!! options
+parsoid=wt2html
+!! input
+<nowiki ><div>[[foo]]</nowiki >
+
+a<nowiki / >b
+
+c<nowiki />d
+
+e<nowiki/ >f
+!! result
+<p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
+<p>ab</p>
+<p>cd</p>
+<p>ef</p>
+!! end
+
+!! test
+Parsoid: Recognize nowiki with odd capitalization
+!! options
+parsoid=wt2html
+!! input
+<noWikI ><div>[[foo]]</Nowiki >
+!! result
+<p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
+!! end
+
+
+!! test
+Parsoid: Escape nowiki with trailing space in tags
+!! options
+parsoid=html2wt
+!! input
+&lt;nowiki &gt; foo &lt;/nowiki &gt;
+
+a&lt;nowiki /&gt;b
+
+c&lt;nowiki/ &gt;d
+!! result
+<p>&lt;nowiki &gt; foo &lt/nowiki ></p>
+<p>a&lt;nowiki /&gt;b</p>
+<p>c&lt;nowiki/ &gt;d</p>
+!! end
+
+!! test
+Parsoid: Escape weird noWikI capitalizations
+!! options
+parsoid=html2wt
+!! input
+&lt;noWikI &gt; foo &lt;/NoWikI &gt;
+!! result
+<p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
+!! end
+
 ###
 ### Message transform tests
 ###
@@ -7807,6 +8003,15 @@ Image with empty attribute
 
 !! end
 
+!! test
+Image with attributes from template.
+!! input
+[[Image:foobar.jpg|{{image_attribs}}]]
+!! result
+<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
+
+!! end
+
 !! test
 Image with link tails
 !! input
@@ -8110,6 +8315,7 @@ SVG thumbnails with invalid language code
 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
 
 !! end
+
 !! test
 BUG 1887: A ISBN with a thumbnail
 !! input
@@ -8497,6 +8703,7 @@ parsoid
 #</span>
 #</p>
 
+
 ###
 ### Subpages
 ###
@@ -8758,6 +8965,17 @@ parsoid
 </p>
 !! end
 
+!! test
+Parsoid: Link prefix/suffixes aren't applied to category links
+!! options
+parsoid=wt2html,wt2wt,html2html
+language=is
+!! input
+x[[Category:Foo]]y
+!! result
+<p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
+!! end
+
 !! test
 Parsoid: Serialize link to file page with colon escape
 !! options
@@ -8784,6 +9002,7 @@ parsoid
 <link rel="mw:WikiLink/Category" href="Category:Foo">
 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
 !! end
+
 ###
 ### Inter-language links
 ###
@@ -9486,6 +9705,81 @@ I always thought &xacute; was a cute letter.
 !! end
 
 
+###
+### Nesting tests (see bug 41545, 50604, 51081)
+###
+
+# This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
+# Note that html2wt is considerably more difficult if we use <b> in
+# the test case, instead of <big>
+!! test
+Ensure that HTML adoption agency algorithm is properly implemented.
+!! input
+<big>X<big>Y</big>Z</big>
+!! result
+<p><big>X<big>Y</big>Z</big>
+</p>
+!! end
+
+# This was bug 41545 in the PHP parser.
+!! test
+Nesting of <kbd>
+!! input
+<kbd>X<kbd>Y</kbd>Z</kbd>
+!! result
+<p><kbd>X<kbd>Y</kbd>Z</kbd>
+</p>
+!! end
+
+# The following cases were bug 51081 in the PHP parser.
+# Note that there are some other nestable tags (b, i, etc) which are
+# not covered; see bug 51081 for discussion.
+!! test
+Nesting of <em>
+!! input
+<em>X<em>Y</em>Z</em>
+!! result
+<p><em>X<em>Y</em>Z</em>
+</p>
+!! end
+
+!! test
+Nesting of <strong>
+!! input
+<strong>X<strong>Y</strong>Z</strong>
+!! result
+<p><strong>X<strong>Y</strong>Z</strong>
+</p>
+!! end
+
+!! test
+Nesting of <q>
+!! input
+<q>X<q>Y</q>Z</q>
+!! result
+<p><q>X<q>Y</q>Z</q>
+</p>
+!! end
+
+!! test
+Nesting of <ruby>
+!! input
+<ruby>X<ruby>Y</ruby>Z</ruby>
+!! result
+<p><ruby>X<ruby>Y</ruby>Z</ruby>
+</p>
+!! end
+
+!! test
+Nesting of <bdo>
+!! input
+<bdo>X<bdo>Y</bdo>Z</bdo>
+!! result
+<p><bdo>X<bdo>Y</bdo>Z</bdo>
+</p>
+!! end
+
+
 ###
 ### Media links
 ###
@@ -9961,7 +10255,7 @@ Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
 !! end
 
 ###
-### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
+### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
 ###
 !! test
 Parser hook: empty input
@@ -10126,7 +10420,7 @@ array (
 !! end
 
 ###
-### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
+### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
 ###
 
 !! test
@@ -12221,7 +12515,7 @@ Images with the "|" character in the comment
 !! test
 HTML with raw HTML ($wgRawHtml==true)
 !! options
-rawhtml
+wgRawHtml=1
 !! input
 <html><script>alert(1);</script></html>
 !! result
@@ -14442,6 +14736,7 @@ HttP://MediaWiki.Org/
 </p>
 !! end
 
+
 ###
 ### Parsoids-specific tests
 ### Parsoid-PHP parser incompatibilities
@@ -14697,9 +14992,10 @@ parsoid
 
 <references />
 !!result
-<p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref&amp;gt;bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> baz&lt;/ref&gt;</p>
+<span about="#mwt1" class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo &amp;lt;ref&amp;gt;bar&amp;lt;/ref&amp;gt; baz&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
 
-<ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar</li></ol>
+<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
+<li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar&lt;/ref&gt; baz</li></ol>
 !!end
 
 !!test
@@ -14806,7 +15102,7 @@ This should just get lost.
 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
 
-<ol about="#mwt7" class="references" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost."},"attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li></ol>
+<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li></ol>
 !!end
 
 !!test
@@ -14819,6 +15115,29 @@ parsoid
 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
 !!end
 
+!! test
+References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
+!! options
+parsoid
+!! input
+A <ref>foo bar for a</ref>
+B <ref name="b" />
+
+<references />
+
+<references>
+<ref name="b">foo</ref>
+</references>
+!! result
+<p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
+B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
+
+<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> </li></ol>
+
+<ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;b&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
+
+!! end
+
 #### ----------------------------------------------------------------
 #### The following section of tests are primarily to test
 #### wikitext escaping capabilities of Parsoid.  Given that
@@ -14869,10 +15188,15 @@ Headings: 1. Nested inside html
 parsoid
 !! input
 =<nowiki>=foo=</nowiki>=
+
 ==<nowiki>=foo=</nowiki>==
+
 ===<nowiki>=foo=</nowiki>===
+
 ====<nowiki>=foo=</nowiki>====
+
 =====<nowiki>=foo=</nowiki>=====
+
 ======<nowiki>=foo=</nowiki>======
 !! result
 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
@@ -14889,9 +15213,11 @@ Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
 parsoid
 !! input
 =foo=
-<nowiki>*bar</nowiki>
+<nowiki>*</nowiki>bar
+
 =foo=
 =bar
+
 =foo=
 <nowiki>=bar=</nowiki>
 !! result
@@ -14916,12 +15242,19 @@ Headings: 4a. No escaping needed (testing just h1 and h2)
 parsoid
 !! input
 ==foo=
+
 =foo==
+
 = =foo= =
+
 ==foo= bar=
+
 ===foo==
+
 ==foo===
+
 =''=''foo==
+
 =<nowiki>=</nowiki>=
 !! result
 <h1>=foo</h1>
@@ -14955,10 +15288,15 @@ Headings: 5. Empty headings
 parsoid
 !! input
 =<nowiki/>=
+
 ==<nowiki/>==
+
 ===<nowiki/>===
+
 ====<nowiki/>====
+
 =====<nowiki/>=====
+
 ======<nowiki/>======
 !! result
 <h1></h1>
@@ -14976,11 +15314,11 @@ parsoid
 !! input
 <nowiki>=a=</nowiki>
 
-<nowiki>=a= </nowiki>
+<nowiki>=a=</nowiki> 
 
-<nowiki>=a=    </nowiki>
+<nowiki>=a=</nowiki>   
 
-<nowiki>=a=    </nowiki>
+<nowiki>=a=</nowiki>   
 !! result
 <p>=a=</p>
 <p>=a= </p>
@@ -15021,8 +15359,8 @@ Headings: 6c. Heading chars in SOL context (leading newline break)
 !! options
 parsoid
 !! input
-<nowiki>a
-=b=</nowiki>
+a
+<nowiki>=b=</nowiki>
 !! result
 <p>a
 =b=</p>
@@ -15035,7 +15373,7 @@ parsoid
 !! input
 <!--c0--><nowiki>=a=</nowiki>
 <!--c1-->
-<nowiki>=a= </nowiki><!--c2-->  <!--c3-->
+<nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
 !! result
 <p><!--c0-->=a=</p>
 <p><!--c1-->=a= <!--c2-->       <!--c3--></p>
@@ -15065,9 +15403,9 @@ parsoid=html2wt
 !! test
 Lists: 0. Outside nests
 !! input
-<nowiki>*foo</nowiki>
+<nowiki>*</nowiki>foo
 
-<nowiki>#foo</nowiki>
+<nowiki>#</nowiki>foo
 !! result
 <p>*foo
 </p><p>#foo
@@ -15212,8 +15550,8 @@ parsoid
 !! test
 Lists: 7. Escape bullets in a multi-line context
 !! input
-<nowiki>a
-*b</nowiki>
+a
+<nowiki>*</nowiki>b
 !! result
 <p>a
 *b
@@ -15426,11 +15764,20 @@ parsoid
 |-
 |''foo''-bar
 |''foo''+bar
+|-
+|foo
+bar|baz
++bar
+-bar
 |}
 !! result
 <table><tbody>
 <tr><td>foo-bar</td><td>foo+bar</td></tr>
 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
+<tr><td>foo
+<p>bar|baz
++bar
+-bar</p></td></tr>
 </tbody></table>
 !! end
 
@@ -15471,7 +15818,7 @@ Links 1. Quote marks in link text
 !! options
 parsoid
 !! input
-[[Foo|<nowiki>Foo''boo''</nowiki>]]
+[[Foo|Foo<nowiki>''boo''</nowiki>]]
 !! result
 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
 !! end
@@ -15542,19 +15889,28 @@ parsoid
 #### 1. Quotes inside <b> and <i>
 #### 2. Link fragments separated by <i> and <b> tags
 #### 3. Link fragments inside <i> and <b>
+#### 4. No escaping needed
 #### --------------------------------------
 !! test
 1. Quotes inside <b> and <i>
+!! options
+parsoid=html2wt,wt2wt
 !! input
 ''<nowiki>'foo'</nowiki>''
 ''<nowiki>''foo''</nowiki>''
 ''<nowiki>'''foo'''</nowiki>''
-''foo''<nowiki>'s</nowiki>
+''foo''<nowiki/>'s
 '''<nowiki>'foo'</nowiki>'''
 '''<nowiki>''foo''</nowiki>'''
 '''<nowiki>'''foo'''</nowiki>'''
 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
-'''foo'''<nowiki>'s</nowiki>
+'''foo'''<nowiki/>'s
+'''foo''
+''foo''<nowiki/>'
+'<nowiki/>''foo''<nowiki/>'
+''''foo'''
+'''foo'''<nowiki/>'
+'<nowiki/>'''foo'''<nowiki/>'
 !! result
 <p><i>'foo'</i>
 <i>''foo''</i>
@@ -15565,7 +15921,12 @@ parsoid
 <b>'''foo'''</b>
 <b>foo'<i>bar'</i>baz</b>
 <b>foo</b>'s
-</p>
+'<i>foo</i>
+<i>foo</i>'
+'<i>foo</i>'
+'<b>foo</b>
+<b>foo</b>'
+'<b>foo</b>'</p>
 !! end
 
 !! test
@@ -15581,7 +15942,7 @@ parsoid
 !! end
 
 !! test
-2. Link fragments inside <i> and <b>
+3. Link fragments inside <i> and <b>
 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
  this is one of the shortcomings of this format)
 !! input
@@ -15594,6 +15955,17 @@ parsoid
 </p>
 !! end
 
+!! test
+4. No escaping needed
+!! input
+'<span>''bar''</span>'
+'<span>'''bar'''</span>'
+!! result
+<p>'<span><i>bar</i></span>'
+'<span><b>bar</b></span>'
+</p>
+!! end
+
 #### ----------- Paragraphs ---------------
 #### 1. No unnecessary escapes
 #### --------------------------------------
@@ -15627,24 +15999,24 @@ bar <span><nowiki>[[foo]]</nowiki></span>
 !! options
 parsoid
 !! input
-<nowiki> a</nowiki>
+<nowiki> </nowiki>a
 
-<nowiki>  a</nowiki>
+<nowiki> </nowiki> a
 
-<nowiki>       a(tab)</nowiki>
+<nowiki>       </nowiki>a(tab)
 
-<nowiki>       a</nowiki>
+<nowiki> </nowiki>     a
 <!--cmt-->
-<nowiki>  a</nowiki>
+<nowiki> </nowiki> a
 
-<nowiki>a
- b</nowiki>
+a
+<nowiki> </nowiki>b
 
-<nowiki>a
-       b</nowiki>
+a
+<nowiki>       </nowiki>b
 
-<nowiki>a
-        b</nowiki>
+a
+<nowiki>       </nowiki> b
 !! result
 <p> a</p>
 <p>  a</p>
@@ -15716,6 +16088,18 @@ Escaping nowikis
 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
 </p>
 !! end
+
+## The quote-char in the input is necessary for triggering the bug
+!! test
+(Bug 52035) Nowiki-escaping should not get tripped by " :" in text
+!! options
+parsoid=wt2wt,html2wt
+!! input
+foo's bar :
+!! result
+<p>foo's bar :</p>
+!! end
+
 !! test
 
 Tag-like HTML structures are passed through as text
@@ -16075,6 +16459,17 @@ parsoid
 </p>
 !!end
 
+!!test
+Encapsulate protected attributes from wt
+!!options
+parsoid
+!!input
+<div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
+!!result
+<body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
+</body>
+!!end
+
 # -----------------------------------------------------------------
 # The following section of tests are primarily to spec requirements
 # around serialization of new/edited content.
@@ -16121,6 +16516,23 @@ parsoid=html2wt
 </ul>
 !! end
 
+!! test
+Parsoid: Serialize positional parameters with = in them as named parameter
+!! options
+parsoid=html2wt
+!! input
+{{echo|1 = f=oo}}
+!! result
+<p about="#mwt1" typeof="mw:Transclusion"
+data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
+>foo</p>
+!! end
+
+# -----------------------------------------------------------------
+# End of section for Parsoid-only html2wt tests for serialization
+# of new content
+# -----------------------------------------------------------------
+
 TODO:
 more images
 more tables