From 539ad2c8e06aceae4afa6e86a4b676c5ca0a909a Mon Sep 17 00:00:00 2001 From: Zheng Zhu Date: Tue, 26 Apr 2005 20:50:16 +0000 Subject: [PATCH] Comments about the position of the convert() call; Avoiding converting external links if latin alphabet is involved in the conversion system. --- includes/Parser.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/Parser.php b/includes/Parser.php index 18fa22816b..306b86006a 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -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 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 & 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 ö 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 { -- 2.20.1