* (bug 1300) Links like [[Image:Foo.png|thumb|[http://example.com]]] now work.
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 12 Apr 2005 06:07:23 +0000 (06:07 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 12 Apr 2005 06:07:23 +0000 (06:07 +0000)
includes/Parser.php

index d5ddd25..0cbcad6 100644 (file)
@@ -1151,6 +1151,14 @@ class Parser
                        
                        if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt
                                $text = $m[2];
+                               # If we get a ] at the beginning of $m[3] that means we have a link that's something like:
+                               # [[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( "/^\](.*)/", $m[3], $n ) ) {
+                                       $text .= ']'; # so that replaceExternalLinks($text) works later
+                                       $m[3] = $n[1];
+                               }
                                # fix up urlencoded title texts
                                if(preg_match('/%/', $m[1] )) $m[1] = urldecode($m[1]);
                                $trail = $m[3];