X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fparser%2FParser.php;h=988e2488d8ed22e824e38ba7c9211517079e8456;hp=3f0e38f5840836987219be12a404134183ef8616;hb=1d7a1bf8bddf0908e4f572c82268733f63126a13;hpb=c6acd961c37a7454d93e5c9a7ee1f9782a16abf4 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 3f0e38f584..988e2488d8 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2296,11 +2296,8 @@ class Parser { $this->mOutput->addLanguageLink( $nt->getFullText() ); } - /** - * Strip the whitespace interwiki links produce, see T10897 - */ $s = rtrim( $s . $prefix ); - $s .= rtrim( $trail, "\n" ); + $s .= trim( $trail, "\n" ) == '' ? '' : $prefix . $trail; continue; } @@ -2325,11 +2322,7 @@ class Parser { continue; } } elseif ( $ns == NS_CATEGORY ) { - /** - * Strip the whitespace Category links produce, see T2087 - */ - $s = rtrim( $s . $prefix ); # T2087, T87753 - $s .= rtrim( $trail, "\n" ); + $s = rtrim( $s . "\n" ); # T2087 if ( $wasblank ) { $sortkey = $this->getDefaultSort(); @@ -2341,6 +2334,11 @@ class Parser { $sortkey = $this->getConverterLanguage()->convertCategoryKey( $sortkey ); $this->mOutput->addCategory( $nt->getDBkey(), $sortkey ); + /** + * Strip the whitespace Category links produce, see T2087 + */ + $s .= trim( $prefix . $trail, "\n" ) == '' ? '' : $prefix . $trail; + continue; } } @@ -2586,7 +2584,7 @@ class Parser { ) ) ); break; case 'talkpagename': - if ( $this->mTitle->canTalk() ) { + if ( $this->mTitle->canHaveTalkPage() ) { $talkPage = $this->mTitle->getTalkPage(); $value = wfEscapeWikiText( $talkPage->getPrefixedText() ); } else { @@ -2594,7 +2592,7 @@ class Parser { } break; case 'talkpagenamee': - if ( $this->mTitle->canTalk() ) { + if ( $this->mTitle->canHaveTalkPage() ) { $talkPage = $this->mTitle->getTalkPage(); $value = wfEscapeWikiText( $talkPage->getPrefixedURL() ); } else { @@ -2694,12 +2692,12 @@ class Parser { $value = $this->mTitle->getNamespace(); break; case 'talkspace': - $value = $this->mTitle->canTalk() + $value = $this->mTitle->canHaveTalkPage() ? str_replace( '_', ' ', $this->mTitle->getTalkNsText() ) : ''; break; case 'talkspacee': - $value = $this->mTitle->canTalk() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : ''; + $value = $this->mTitle->canHaveTalkPage() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : ''; break; case 'subjectspace': $value = str_replace( '_', ' ', $this->mTitle->getSubjectNsText() );