Merge "Sync up with Parsoid parserTests.txt"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 12 Jun 2017 20:51:54 +0000 (20:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 12 Jun 2017 20:51:54 +0000 (20:51 +0000)
1  2 
tests/parser/parserTests.txt

@@@ -8301,6 -8301,21 +8301,21 @@@ subpag
  <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
  !! end
  
+ !! test
+ Serialization of purely hash wikilink
+ !! options
+ title=[[User:Test/123]]
+ subpage
+ parsoid=html2wt
+ !! html/parsoid
+ <p><a href="#a">[[</a></p>
+ !! wikitext
+ [[#a|<nowiki>[[</nowiki>]]
+ !! html/php
+ <p><a href="#a">[[</a>
+ </p>
+ !! end
  !! test
  1. Interaction of linktrail and template encapsulation
  !! wikitext
@@@ -15937,7 -15952,7 +15952,7 @@@ Section headings with TO
  Some text
  ===Another headline===
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
  <ul>
@@@ -15980,7 -15995,7 +15995,7 @@@ __FORCETOC_
  == Headline 2 ==
  == Headline ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
@@@ -16011,7 -16026,7 +16026,7 @@@ Handling of sections up to level 6 and 
  ========= Level 9 Heading=========
  ========== Level 10 Heading==========
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
  <ul>
@@@ -16064,7 -16079,7 +16079,7 @@@ TOC regression (T11764
  == title 2 ==
  === title 2.1 ===
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  <ul>
@@@ -16099,7 -16114,7 +16114,7 @@@ TOC for heading containing <span id="..
  __FORCETOC__
  ==<span id="old-anchor"></span>New title==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
  </ul>
@@@ -16121,7 -16136,7 +16136,7 @@@ wgMaxTocLevel=
  == title 2 ==
  === title 2.1 ===
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  <ul>
@@@ -16157,7 -16172,7 +16172,7 @@@ wgMaxTocLevel=
  ====Section 1.1.1.1====
  ==Section 2==
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
  <ul>
@@@ -16250,7 -16265,7 +16265,7 @@@ __TOC_
  === title 1.1 ===
  == title 2 ==
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  <ul>
@@@ -16317,7 -16332,7 +16332,7 @@@ section 
  !! html
  <p>The tooltips shall not show entities to the user (ie. be double escaped)
  </p>
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
@@@ -16376,7 -16391,7 +16391,7 @@@ section 
  !! html
  <p>Id should not contain + for spaces
  </p>
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
@@@ -16422,7 -16437,7 +16437,7 @@@ Headers with excess '=' character
  =''italic'' heading==
  ==''italic'' heading=
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
@@@ -16452,7 -16467,7 +16467,7 @@@ HTML headers vs TOC (T25393
  == Header 2.2 ==
  __NOEDITSECTION__
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
  <ul>
@@@ -17895,6 -17910,19 +17910,19 @@@ Sanitizer: Validating that <meta> and <
  
  !! end
  
+ !! test
+ Sanitizer: Strip comments from CSS attributes
+ !! options
+ parsoid=wt2html,wt2wt
+ !! wikitext
+ <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
+ !! html/php
+ <p><span style="margin: -0.125em -0.45em;  rgba(255, 0, 0, 0.3)">2013</span>
+ </p>
+ !! html/parsoid
+ <p><span style="margin: -0.125em -0.45em;  rgba(255, 0, 0, 0.3)">2013</span></p>
+ !! end
  !! test
  Language converter: output gets cut off unexpectedly (T7757)
  !! options
@@@ -18240,7 -18268,7 +18268,7 @@@ Fuzz testing: Parser1
  http://__TOC__
  !! html
  <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 -http://<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
  </ul>
  <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <p>http://</p>
  <div id="toc" class="toc">
 -<div id="toctitle" class="toctitle">
 +<div class="toctitle">
  <h2>Contents</h2>
  </div>
  <ul>
@@@ -20733,7 -20761,7 +20761,7 @@@ Out-of-order TOC heading level
  =====5=====
  ==2==
  !! html
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
  <ul>
@@@ -22753,7 -22781,7 +22781,7 @@@ title=[[Main Page]
  __TOC__
  == ''Lost'' episodes ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
  </ul>
@@@ -22774,7 -22802,7 +22802,7 @@@ title=[[Main Page]
  __TOC__
  == '''should be bold''' then normal text ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
  </ul>
@@@ -22795,7 -22823,7 +22823,7 @@@ title=[[Main Page]
  __TOC__
  == Image [[Image:foobar.jpg]] ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
  </ul>
@@@ -22816,7 -22844,7 +22844,7 @@@ title=[[Main Page]
  __TOC__
  == <blockquote>Quote</blockquote> ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
  </ul>
  !! html/php+tidy
  <p></p>
  <div id="toc" class="toc">
 -<div id="toctitle" class="toctitle">
 +<div class="toctitle">
  <h2>Contents</h2>
  </div>
  <ul>
@@@ -22855,7 -22883,7 +22883,7 @@@ __TOC_
  <small>Hanc marginis exiguitas non caperet.</small>
  QED
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
  </ul>
@@@ -22880,7 -22908,7 +22908,7 @@@ __TOC_
  
  == <i>Foo</i> <blockquote>Bar</blockquote> ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
  !! html/php+tidy
  <p></p>
  <div id="toc" class="toc">
 -<div id="toctitle" class="toctitle">
 +<div class="toctitle">
  <h2>Contents</h2>
  </div>
  <ul>
@@@ -22926,7 -22954,7 +22954,7 @@@ __TOC_
  
  == <sup class="a > b">Evilbye</sup> ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
@@@ -22957,7 -22985,7 +22985,7 @@@ __TOC_
  
  == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
@@@ -22988,7 -23016,7 +23016,7 @@@ T74884: bdi element in To
  __TOC__
  == <bdi>test</bdi> ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
  </ul>
@@@ -23007,7 -23035,7 +23035,7 @@@ T35715: s/strike element in To
  __TOC__
  == <s>test</s> test <strike>test</strike> ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
  </ul>
@@@ -23029,7 -23057,7 +23057,7 @@@ Empty <p> tag in TOC, removed by Saniti
  __TOC__
  == x ==
  !! html/php
 -<div id="toc" class="toc"><div id="toctitle" class="toctitle"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
  </ul>
  !! html/php+tidy
  <p></p>
  <div id="toc" class="toc">
 -<div id="toctitle" class="toctitle">
 +<div class="toctitle">
  <h2>Contents</h2>
  </div>
  <ul>
@@@ -23420,26 -23448,26 +23448,26 @@@ parsoid=
  <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
  !! end
  
- ## The unconventional output is the result of `usePHPPreProcessor` being
- ## disabled in parserTests.js.  This test is mainly just to show <section> is
- ## recognized as an extension tag w/o a native handler.
  !! test
  LST Sections: Newfangled approach
  !! wikitext
  <section begin="2011-05-16" />
  <section end="2014-04-10 (MW 1.23wmf22)" />
  !! html/parsoid
- <p><span typeof="mw:Error mw:Extension/section" about="#mwt1" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null,"errors":[{"key":"mw-api-extexpand-error","message":"Could not expand extension source."}]}'>&lt;section begin="2011-05-16" /></span>
- <span typeof="mw:Error mw:Extension/section" about="#mwt2" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null,"errors":[{"key":"mw-api-extexpand-error","message":"Could not expand extension source."}]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
+ <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
+ </span>
+ <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
+ </span></p>
  !! end
  
  #--------- Test stripping of empty nodes in template content ----------
- !!test
+ !! test
  Empty LI and TR nodes should be stripped from template content
- !!wikitext
+ !! wikitext
  {{EmptyLITest}}
  {{EmptyTRTest}}
- !!html/parsoid
+ !! html/parsoid
  <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
  <li>a</li>
  <li>b</li>
  </tr>
  </tbody>
  </table>
- !!end
+ !! end
  
- !!test
+ !! test
  Empty LI and TR nodes should not be stripped from top-level content
- !!wikitext
+ !! wikitext
  * a
  *
  * b
  |-
  |foo
  |}
- !!html/parsoid
+ !! html/parsoid
  <ul>
  <li> a</li>
  <li></li>
  </tr>
  </tbody>
  </table>
- !!end
+ !! end
  
- !!test
+ !! test
  Empty TR nodes should not be stripped if they have any attributes set
- !!wikitext
+ !! wikitext
  {{EmptyTRWithHTMLAttrTest}}
- !!html/parsoid
+ !! html/parsoid
  <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
  <tr align="center"></tr>
  <tr><td>foo</td></tr>
  <tr align="center"></tr>
  <tr><td>bar</td></tr>
  </table>
- !!end
+ !! end
  
  #### ----------------------------------------------------------------
  #### The following section of tests are primarily to test
@@@ -25911,6 -25939,41 +25939,41 @@@ parsoid=html2w
  [[Foo]]
  !! end
  
+ !! test
+ Parsoid should accept interwiki shortcuts
+ !! options
+ parsoid=html2wt
+ !! html/parsoid
+ <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
+ <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
+ <a href='./fr:Foo'>Foo</a></p>
+ <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
+ <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
+ <a href='fr%3AFoo'>Foo</a></p>
+ !! wikitext
+ [[:fr:Foo|Foo]]
+ [[:fr:Foo|Foo]]
+ [[:fr:Foo|Foo]]
+ [[:fr:Foo|Foo]]
+ [[:fr:Foo|Foo]]
+ [[:fr:Foo|Foo]]
+ !! end
+ !! test
+ Parsoid should not accept invalid interwiki shortcuts
+ !! options
+ parsoid=html2wt
+ !! html/parsoid
+ <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
+ <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
+ <a href='news:Foo'>Foo</a></p>
+ !! wikitext
+ [news:Foo Foo]
+ [news:Foo Foo]
+ [news:Foo Foo]
+ !! end
  # See T93839
  !! test
  New wikilinks should be serialized properly
  <span name="foo"></span>
  !! end
  
+ !! test
+ New transclusion added after a list should be serialized after the list
+ !! options
+ parsoid=html2wt
+ !! html/parsoid
+ <ul><li>a</li></ul><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>
+ !! wikitext
+ * a
+ {{echo|foo}}
+ !! end
  # -----------------------------------------------------------------
  # End of section for Parsoid-only html2wt tests for serialization
  # of new content