From: Brion Vibber Date: Mon, 9 Aug 2004 02:45:38 +0000 (+0000) Subject: Fix for [ 965008 ] Links in edit summaries don't use linktrail X-Git-Tag: 1.5.0alpha1~2458 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=6daafb79ae243f33a1fb605e43e4c344147456c3;p=lhc%2Fweb%2Fwiklou.git Fix for [ 965008 ] Links in edit summaries don't use linktrail --- diff --git a/includes/Skin.php b/includes/Skin.php index 2bf98402cc..17ddf6ee4e 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2501,22 +2501,28 @@ class Skin { # format regular and media links - all other wiki formatting # is ignored $medians = $wgLang->getNsText(Namespace::getMedia()).':'; - while(preg_match('/\[\[(.*?)(\|(.*?))*\]\]/',$comment,$match)) { + while(preg_match('/\[\[(.*?)(\|(.*?))*\]\](.*)$/',$comment,$match)) { # Handle link renaming [[foo|text]] will show link as "text" - if(isset($match[3]) ) { + if( "" != $match[3] ) { $text = $match[3]; } else { $text = $match[1]; } - if ( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) { - # Media link - $comment = preg_replace( '/\[\[(.*?)\]\]/', $this->makeMediaLink( $submatch[1], "", $text ), - $comment, 1 ); + if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) { + # Media link; trail not supported. + $linkRegexp = '/\[\[(.*?)\]\]/'; + $thelink = $this->makeMediaLink( $submatch[1], "", $text ); } else { # Other kind of link - $comment = preg_replace('/\[\[(.*?)\]\]/', $this->makeLink( $match[1], $match[1] ), - $comment , 1); + if( preg_match( wfMsg( "linktrail" ), $match[4], $submatch ) ) { + $trail = $submatch[1]; + } else { + $trail = ""; + } + $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/'; + $thelink = $this->makeLink( $match[1], $text, "", $trail ); } + $comment = preg_replace( $linkRegexp, $thelink, $comment, 1 ); } return $comment; }