X-Git-Url: http://git.cyclocoop.org/%22%20%20.%20generer_url_ecrire%28%22mots_tous%22%29%20.%20%22?a=blobdiff_plain;f=includes%2Fparser%2FParser.php;h=5da25465c6163492519a9faa1b0d2087d30bba96;hb=3b5b239e853c78114147a51b7c66b13e0ccd561d;hp=4a78ff8321dfc2fc60d2cd4faf5c8045de89b38f;hpb=9e8c3843746e1ecd68444fb99f59dd91d59e9349;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 4a78ff8321..5da25465c6 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2240,12 +2240,6 @@ class Parser { $link = $origLink; } - $noforce = ( substr( $origLink, 0, 1 ) !== ':' ); - if ( !$noforce ) { - # Strip off leading ':' - $link = substr( $link, 1 ); - } - $unstrip = $this->mStripState->unstripNoWiki( $link ); $nt = is_string( $unstrip ) ? Title::newFromText( $unstrip ) : null; if ( $nt === null ) { @@ -2256,6 +2250,8 @@ class Parser { $ns = $nt->getNamespace(); $iw = $nt->getInterwiki(); + $noforce = ( substr( $origLink, 0, 1 ) !== ':' ); + if ( $might_be_img ) { # if this is actually an invalid link if ( $ns == NS_FILE && $noforce ) { # but might be an image $found = false; @@ -2300,6 +2296,10 @@ class Parser { $wasblank = ( $text == '' ); if ( $wasblank ) { $text = $link; + if ( !$noforce ) { + # Strip off leading ':' + $text = substr( $text, 1 ); + } } else { # T6598 madness. Handle the quotes only if they come from the alternate part # [[Lista d''e paise d''o munno]] -> Lista d''e paise d''o munno @@ -2324,7 +2324,7 @@ class Parser { } $s = rtrim( $s . $prefix ); - $s .= trim( $trail, "\n" ) == '' ? '': $prefix . $trail; + $s .= trim( $trail, "\n" ) == '' ? '' : $prefix . $trail; continue; }