From 6daafb79ae243f33a1fb605e43e4c344147456c3 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 9 Aug 2004 02:45:38 +0000 Subject: [PATCH] Fix for [ 965008 ] Links in edit summaries don't use linktrail --- includes/Skin.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) 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; } -- 2.20.1