Fix for the main (no pipe) case of bug 2095, triple closing backets on link
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 18 May 2005 09:21:47 +0000 (09:21 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 18 May 2005 09:21:47 +0000 (09:21 +0000)
was putting the extra bracket as the link text instead of the trail.
This was due to a broken workaround for links in image captions.
For now it will still move the bracket inside the link text for piped links,
which is wrong and ought to be fixed.

RELEASE-NOTES
includes/Parser.php

index d5b9b58..4b3eb04 100644 (file)
@@ -194,6 +194,7 @@ Various bugfixes, small features, and a few experimental things:
   ogg, pdf, ps, rm, rpm, tar, tex, ttf and txt files based on the KDE
   crystalsvg theme.
 * Fixed a bug in Special:Newimages that made it impossible to search for '0'
+* (bug 2095) Triple-closing-bracket thing partly fixed
 
 
 === Caveats ===
index fc6db01..99e5c28 100644 (file)
@@ -1214,7 +1214,11 @@ class Parser
                                # [[Image:Foo.jpg|[http://example.com desc]]] <- having three ] in a row fucks up,
                                # the real problem is with the $e1 regex
                                # See bug 1300.
-                               if (preg_match( "/^\](.*)/s", $m[3], $n ) ) {
+                               #
+                               # Still some problems for cases where the ] is meant to be outside punctuation,
+                               # and no image is in sight. See bug 2095.
+                               #
+                               if( $text !== '' && preg_match( "/^\](.*)/s", $m[3], $n ) ) {
                                        $text .= ']'; # so that replaceExternalLinks($text) works later
                                        $m[3] = $n[1];
                                }