* (bug 5081) Remove bogus fix for invalid characters in links which simply
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 26 Feb 2006 02:25:56 +0000 (02:25 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 26 Feb 2006 02:25:56 +0000 (02:25 +0000)
  broke use of legitimate multiple whitespace characters in bracketed link.
Broken by Magnus's revision 1.593 of Parser.php, February 22 2006

RELEASE-NOTES
includes/Parser.php
maintenance/parserTests.txt

index 2fd0757..8ae8052 100644 (file)
@@ -657,6 +657,8 @@ fully support the editing toolbar, but was found to be too confusing.
 * Make Live Preview an user preference, still controllable by the global variable
 * Rename the stub LanguageAls / LanguageGem_alsation to LanguageGsw to follow
   updated language code assignments
+* (bug 5081) Remove bogus fix for invalid characters in links which simply
+  broke use of legitimate multiple whitespace characters in bracketed link.
 
 
 === Caveats ===
index c4fed1d..47644b8 100644 (file)
@@ -51,7 +51,7 @@ define( 'EXT_LINK_URL_CLASS', '[^][<>"\\x00-\\x20\\x7F]' );
 define( 'EXT_LINK_TEXT_CLASS', '[^\]\\x00-\\x1F\\x7F]' );
 define( 'EXT_IMAGE_FNAME_CLASS', '[A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]' );
 define( 'EXT_IMAGE_EXTENSIONS', 'gif|png|jpg|jpeg' );
-define( 'EXT_LINK_BRACKETED',  '/\[(\b(' . wfUrlProtocols() . ')'.EXT_LINK_URL_CLASS.'+)( *)('.EXT_LINK_TEXT_CLASS.'*?)\]/S' );
+define( 'EXT_LINK_BRACKETED',  '/\[(\b(' . wfUrlProtocols() . ')'.EXT_LINK_URL_CLASS.'+) *('.EXT_LINK_TEXT_CLASS.'*?)\]/S' );
 define( 'EXT_IMAGE_REGEX',
        '/^('.HTTP_PROTOCOLS.')'.  # Protocol
        '('.EXT_LINK_URL_CLASS.'+)\\/'.  # Hostname and path
@@ -1085,7 +1085,6 @@ class Parser
                while ( $i<count( $bits ) ) {
                        $url = $bits[$i++];
                        $protocol = $bits[$i++];
-                       $spaces = $bits[$i++];
                        $text = $bits[$i++];
                        $trail = $bits[$i++];
 
@@ -1143,13 +1142,7 @@ class Parser
                        # This means that users can paste URLs directly into the text
                        # Funny characters like &ouml; aren't valid in URLs anyway
                        # This was changed in August 2004
-                       if ( strlen ( $spaces ) < 2 ) {
-                               # Normal case
-                               $s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail;
-                       } else {
-                               # Fix for [url  text] (notice the two blanks)
-                               $s .= '[' . $sk->makeExternalLink( $url, $url, false, "free" ) . $spaces . $text . ']' . $dtrail . $trail;
-                       }
+                       $s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail;
 
                        # Register link in the output object
                        $this->mOutput->addExternalLink( $url );
index 30e9cdf..5e90909 100644 (file)
@@ -676,6 +676,15 @@ External links: invalid character
 </p>
 !! end
 
+!! test
+External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
+!! input
+[http://www.example.com  test]
+!! result
+<p><a href="http://www.example.com" class='external text' title="http://www.example.com" rel="nofollow">test</a>
+</p>
+!! end
+
 !! test
 BUG 787: Links with one slash after the url protocol are invalid
 !! input