Merge "Show ParserOutput warning instead of on the actual page output for ignored...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 2 Jun 2016 21:23:04 +0000 (21:23 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 2 Jun 2016 21:23:04 +0000 (21:23 +0000)
1  2 
includes/parser/CoreParserFunctions.php
tests/parser/parserTests.txt

@@@ -460,14 -460,14 +460,14 @@@ class CoreParserFunctions 
                                return '';
                        }
                } else {
-                       $parser->addTrackingCategory( 'restricted-displaytitle-ignored' );
                        $converter = $parser->getConverterLanguage()->getConverter();
-                       return '<span class="error">' .
+                       $parser->getOutput()->addWarning(
                                wfMessage( 'restricted-displaytitle',
                                        // Message should be parsed, but this param should only be escaped.
                                        $converter->markNoConversion( wfEscapeWikiText( $text ) )
-                               )->inContentLanguage()->text() .
-                               '</span>';
+                               )->text()
+                       );
+                       $parser->addTrackingCategory( 'restricted-displaytitle-ignored' );
                }
        }
  
                // fetch revision from cache/database and return the value
                $rev = self::getCachedRevisionObject( $parser, $title );
                $length = $rev ? $rev->getSize() : 0;
 +              if ( $length === null ) {
 +                      // We've had bugs where rev_len was not being recorded for empty pages, see T135414
 +                      $length = 0;
 +              }
                return self::formatRaw( $length, $raw );
        }
  
@@@ -2269,11 -2269,9 +2269,11 @@@ Entities inside <pre
  <nowiki> inside of #tag:pre
  !! wikitext
  {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
 -!! html
 +!! html/php
  <pre>Foo &#8594;bar</pre>
  
 +!! html/parsoid
 +<pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
  !! end
  
  !! test
@@@ -2824,7 -2822,7 +2824,7 @@@ parsoi
  !! wikitext
  {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
  !! html
 -<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
 +<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main_Page bar]</p>
  !! end
  
  !! test
@@@ -4782,15 -4780,6 +4782,15 @@@ ok-<a rel="nofollow" class="external fr
  </p>
  !! end
  
 +!! test
 +External links: nofollow domain exception
 +!! wikitext
 +A [https://no-nofollow.org/foobar link], and another [https://example.org link].
 +!! html
 +<p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
 +</p>
 +!!end
 +
  !! test
  External image
  !! wikitext
@@@ -7500,7 -7489,7 +7500,7 @@@ Example for such a section: == < =
  <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
  </p>
  !! html/parsoid
 -<p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
 +<p><a rel="mw:WikiLink" href="./Main_Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#%3E" title="Main Page">#></a></p>
  !! end
  
  !! test
@@@ -9951,7 -9940,7 +9951,7 @@@ Parsoid: Page property magic word with 
  !! wikitext
  {{DISPLAYTITLE:''{{PAGENAME}}''}}
  !! html/parsoid
 -<meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
 +<meta property="mw:PageProp/displaytitle" content="Main_Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main_Page&lt;/span>&lt;/i>"}]]}'/>
  !! end
  
  !! test
@@@ -13964,7 -13953,7 +13964,7 @@@ Redirected imag
  !! wikitext
  [[Image:Barfoo.jpg]]
  !! html/php
 -<p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
 +<p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
  </p>
  !! end
  
@@@ -20666,7 -20655,6 +20666,6 @@@ this is not the the titl
  !! html/php
  Screen
  <p>this is not the the title
- <span class="error"><strong>Warning:</strong> Display title "whatever" was ignored since it is not equivalent to the page's actual title.</span>
  </p>
  !! end