From 43fe2dcbe2a75a2c70855ec4212f9be6e2f00c47 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 18 May 2005 09:21:47 +0000 Subject: [PATCH] Fix for the main (no pipe) case of bug 2095, triple closing backets on link 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 | 1 + includes/Parser.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d5b9b58519..4b3eb0448d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Parser.php b/includes/Parser.php index fc6db01c67..99e5c282fe 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -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]; } -- 2.20.1