Comments about the position of the convert() call;
authorZheng Zhu <zhengzhu@users.mediawiki.org>
Tue, 26 Apr 2005 20:50:16 +0000 (20:50 +0000)
committerZheng Zhu <zhengzhu@users.mediawiki.org>
Tue, 26 Apr 2005 20:50:16 +0000 (20:50 +0000)
Avoiding converting external links if latin alphabet is involved in the conversion system.

includes/Parser.php

index 18fa228..306b860 100644 (file)
@@ -202,8 +202,13 @@ class Parser
                $text = $this->doBlockLevels( $text, $linestart );
 
                $this->replaceLinkHolders( $text );
+
+               # the position of the convert() call should not be changed. it 
+               # assumes that the links are all replaces and the only thing left 
+               # is the <nowiki> mark.
                $text = $wgContLang->convert($text);
                $this->mOutput->setTitleText($wgContLang->getParsedTitle());
+
                $text = $this->unstripNoWiki( $text, $this->mStripState );
                
                $text = Sanitizer::normalizeCharReferences( $text );
@@ -1014,6 +1019,8 @@ class Parser
                                }
                        }
 
+                       $text = $wgContLang->markNoConversion($text);
+
                        # Replace &amp; from obsolete syntax with &.
                        # All HTML entities will be escaped by makeExternalLink()
                        # or maybeMakeImageLink()
@@ -1023,6 +1030,7 @@ class Parser
                        # replacing any non-bracketed links
                        $trail = $this->replaceFreeExternalLinks( $trail );
 
+
                        # Use the encoded URL
                        # This means that users can paste URLs directly into the text
                        # Funny characters like &ouml; aren't valid in URLs anyway
@@ -1039,6 +1047,7 @@ class Parser
         * @access private
         */
        function replaceFreeExternalLinks( $text ) {
+               global $wgContLang;
                $fname = 'Parser::replaceFreeExternalLinks';
                wfProfileIn( $fname );
                
@@ -1087,7 +1096,7 @@ class Parser
                                $text = $this->maybeMakeImageLink( $url );
                                if ( $text === false ) {
                                        # Not an image, make a link
-                                       $text = $sk->makeExternalLink( $url, $url, true, 'free' );
+                                       $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free' );
                                }
                                $s .= $text . $trail;
                        } else {