Merge "Use `class="free external"` only on unbracketed URLs"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 7 Mar 2018 05:49:24 +0000 (05:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 7 Mar 2018 05:49:24 +0000 (05:49 +0000)
RELEASE-NOTES-1.31
includes/parser/Parser.php
tests/parser/parserTests.txt

index 83669e6..718ada9 100644 (file)
@@ -285,6 +285,8 @@ changes to languages because of Phabricator reports.
   * Parser::isValidHalfParsedText()
   * StripState::getSubState()
   * StripState::merge()
+* The "free" class is now only applied to unbracketed URLs in wikitext. Links
+  written using square brackets will get the class "text" not "free".
 
 == Compatibility ==
 MediaWiki 1.31 requires PHP 5.5.9 or later. Although HHVM 3.18.5 or later is supported,
index 8e5dcbd..9458728 100644 (file)
@@ -1868,8 +1868,8 @@ class Parser {
 
                        $dtrail = '';
 
-                       # Set linktype for CSS - if URL==text, link is essentially free
-                       $linktype = ( $text === $url ) ? 'free' : 'text';
+                       # Set linktype for CSS
+                       $linktype = 'text';
 
                        # No link text, e.g. [http://domain.tld/some.link]
                        if ( $text == '' ) {
index 6da23e1..f98044b 100644 (file)
@@ -4937,7 +4937,7 @@ parsoid=wt2html
 !! wikitext
 URL in text: [http://example.com http://example.com]
 !! html/php
-<p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
+<p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
 </p>
 !! html/parsoid
 <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
@@ -22532,8 +22532,8 @@ gopher://www.google.com
 !! html/php
 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
-<a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
-<a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
+<a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
+<a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>