Merge "Test improperly quoted attribute values in HTML tags and table cells"
authorSubramanya Sastry <ssastry@wikimedia.org>
Fri, 25 Jan 2013 18:15:45 +0000 (18:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 25 Jan 2013 18:15:45 +0000 (18:15 +0000)
1  2 
tests/parser/parserTests.txt

@@@ -785,24 -785,6 +785,24 @@@ x <div>foo</div> 
  
  !! end
  
 +!! test
 +Empty lines between block tags to test open p-tags are closed between the block tags
 +!! input
 +<div></div>
 +
 +
 +<div></div>a
 +
 +b
 +!! result
 +<div></div>
 +<p><br />
 +</p>
 +<div></div>a
 +<p>b
 +</p>
 +!! end
 +
  ###
  ### Preformatted text
  ###
  
  !!end
  
 +!!test
 +2c. Indent-Pre and tables (bug 42252)
 +!!input
 +{|
 + |+ foo
 + !  | bar
 +|}
 +!!result
 +<table>
 +<caption> foo
 +</caption>
 +<tr>
 +<th> bar
 +</th></tr></table>
 +
 +!!end
 +
  !!test
  3a. Indent-Pre and block tags (single-line html)
  !!input
  
  !!end
  
 +!! test
 +5. White-space in indent-pre
 +NOTE: the white-space char on 2nd line is significant
 +!! input
 + a<br/>
 + 
 + b
 +!! result
 +<pre>a<br />
 +
 +b
 +</pre>
 +!! end
 +
  ###
  ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
  ###
@@@ -3712,24 -3663,6 +3712,24 @@@ language=ka
  </p>
  !! end
  
 +!! test
 +Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
 +!! input
 +[[Foo|  bar]]
 +
 +[[Foo|  ''bar'']]
 +
 +[http://wp.org   foo]
 +
 +[http://wp.org   ''foo'']
 +!! result
 +<p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
 +</p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  <i>bar</i></a>
 +</p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
 +</p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
 +</p>
 +!! end
 +
  ###
  ### Interwiki links (see maintenance/interwiki.sql)
  ###
@@@ -4226,20 -4159,6 +4226,20 @@@ disable
  </li></ul>
  !! end
  
 +!! test
 +Unclosed formatting tags that straddle lists are closed and reopened
 +(Disabled since php parser generates broken html -- relies on Tidy to fix up)
 +!! options
 +disabled
 +!! input
 +# <s> a
 +# b </s>
 +!! result
 +<ol><li> <s> a </s>
 +</li><li> <s> b </s>
 +</li></ol>
 +!! end
 +
  !! test
  List items are not parsed correctly following a <pre> block (bug 785)
  !! input
@@@ -4729,7 -4648,7 +4729,7 @@@ Magic links: RFC (bug 479
  !! input
  RFC 822
  !! result
 -<p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc822">RFC 822</a>
 +<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
  </p>
  !! end
  
@@@ -4747,7 -4666,7 +4747,7 @@@ Magic links: PMID incorrectly converts 
  !! input
  PMID 1234
  !! result
 -<p><a class="external mw-magiclink-pmid" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
 +<p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
  </p>
  !! end
  
@@@ -6907,7 -6826,7 +6907,7 @@@ BUG 1887: A RFC with a thumbnai
  !! input
  [[Image:foobar.jpg|thumb|This is RFC 12354]]
  !! result
 -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
 +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
  
  !! end
  
@@@ -10517,7 -10436,7 +10517,7 @@@ Double RF
  !! input
  RFC RFC 1234
  !! result
 -<p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
 +<p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
  </p>
  !! end
  
@@@ -10535,7 -10454,7 +10535,7 @@@ RFC code coverag
  !! input
  RFC   983&#x20;987
  !! result
 -<p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
 +<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
  </p>
  !! end
  
@@@ -12675,23 -12594,6 +12675,23 @@@ File:foobar.jpg|caption|alt=galleryalt|
  
  !! end
  
 +!!test
 +Gallery with invalid title as link (bug 43964)
 +!! input
 +<gallery>
 +File:foobar.jpg|link=<
 +</gallery>
 +!! result
 +<ul class="gallery">
 +              <li class="gallerybox" style="width: 155px"><div style="width: 155px">
 +                      <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
 +                      <div class="gallerytext">
 +                      </div>
 +              </div></li>
 +</ul>
 +
 +!! end
 +
  !!test
  Language parser function
  !! input
@@@ -13277,23 -13179,6 +13277,23 @@@ disable
  </tbody></table>
  !! end
  
 +!! test
 +Tables: 4d. No escaping needed
 +!! input
 +{|
 +||+1
 +||-2
 +|}
 +!! result
 +<table>
 +<tr>
 +<td>+1
 +</td>
 +<td>-2
 +</td></tr></table>
 +
 +!! end
 +
  #### --------------- Links ---------------
  #### 1. Quote marks in link text
  #### 2. Wikilinks: Escapes needed
@@@ -13568,6 -13453,29 +13568,29 @@@ HTML tag with 'unnecessary' entity enco
  </p>
  !! end
  
+ !! test
+ HTML tag with broken attribute value quoting
+ !! input
+ <span title="Hello world>Foo</span>
+ !! result
+ <p><span>Foo</span>
+ </p>
+ !! end
+ !! test
+ Table with broken attribute value quoting
+ !! input
+ {|
+ | title="Hello world|Foo
+ |}
+ !! result
+ <table>
+ <tr>
+ <td>Foo
+ </td></tr></table>
+ !! end
  TODO:
  more images
  more tables