From: Liangent
Date: Fri, 25 Jan 2013 10:04:54 +0000 (+0800)
Subject: Fix self link issues about titles in different or mixed variants
X-Git-Tag: 1.31.0-rc.0~20840^2
X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=bca8b8ad7d2f4da53169c4d242b912829d8a3430;p=lhc%2Fweb%2Fwiklou.git
Fix self link issues about titles in different or mixed variants
Change-Id: I64a1b25a45cb8df9fea6fbbfd92cac2e6d53ff98
---
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 0f22755e09..b19137d71c 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1814,12 +1814,6 @@ class Parser {
$prefix = '';
}
- if ( $this->getConverterLanguage()->hasVariants() ) {
- $selflink = $this->getConverterLanguage()->autoConvertToAllVariants(
- $this->mTitle->getPrefixedText() );
- } else {
- $selflink = array( $this->mTitle->getPrefixedText() );
- }
$useSubpages = $this->areSubpagesAllowed();
wfProfileOut( __METHOD__.'-setup' );
@@ -2055,7 +2049,11 @@ class Parser {
# Self-link checking
if ( $nt->getFragment() === '' && $ns != NS_SPECIAL ) {
- if ( in_array( $nt->getPrefixedText(), $selflink, true ) ) {
+ if ( $nt->equals( $this->mTitle ) || ( !$nt->isKnown() && in_array(
+ $this->mTitle->getPrefixedText(),
+ $this->getConverterLanguage()->autoConvertToAllVariants( $nt->getPrefixedText() ),
+ true
+ ) ) ) {
$s .= $prefix . Linker::makeSelfLinkObj( $nt, $text, '', $trail );
continue;
}
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index e83a3041bf..26e45cede6 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -10851,6 +10851,22 @@ Both [[Dunav]] and [[ÐÑнав]] are names for this river.
!!end
+!! article
+ÐÑна
+!! text
+content
+!! endarticle
+
+!! test
+Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
+!! options
+title=[[Duna]] language=sr
+!! input
+[[ÐÑна]] is not a self-link while [[Duna]] and [[DÑна]] are still self-links.
+!! result
+ÐÑна is not a self-link while Duna and DÑна are still self-links.
+
+!! end
!! test
Link to pages in language variants