Reedy has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/375096 )

Change subject: Revert "Fix link prefix/suffixes around Category and Language 
links."
......................................................................

Revert "Fix link prefix/suffixes around Category and Language links."

This reverts commit c66c9aa5352743b2f87bc4627a1be529c5d18535.
Bug: T174639

Change-Id: Ibf6d3780f384ba8edc80bf28c893f1aee8ce28a8
---
M includes/parser/Parser.php
M tests/parser/parserTests.txt
2 files changed, 7 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/96/375096/1

diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 3f0e38f..3eead8e 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -2296,11 +2296,8 @@
                                                
$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 @@
                                                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 @@
                                        $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;
                                }
                        }
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 2fa3cb0..ab79b59 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -15808,26 +15808,6 @@
 !! end
 
 !! test
-9. Categories and newlines: should behave properly with linkprefix (T87753)
-!! options
-language=ar
-!! wikitext
-foo bar
-foo bar
-[[تصنيف:Foo]]
-[[تصنيف:Bar]]
-!! html/php
-<p>foo bar
-foo bar
-</p>
-!! html/parsoid
-<p>foo bar
-foo bar</p>
-<link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
-<link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
-!! end
-
-!! test
 Category links with multiple namespaces
 !! wikitext
 [[Category:Project:Foo]]
@@ -15872,20 +15852,6 @@
 </p>
 !! html/parsoid
 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" 
data-parsoid=""/>y</p>
-!! end
-
-!! test
-Link prefix/suffixes aren't applied to language links
-!! options
-parsoid=wt2html
-language=is
-!! wikitext
-x[[es:Foo]]y
-!! html/php
-<p>xy
-</p>
-!! html/parsoid
-<p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo"; 
data-parsoid=""/>y</p>
 !! end
 
 !! test

-- 
To view, visit https://gerrit.wikimedia.org/r/375096
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf6d3780f384ba8edc80bf28c893f1aee8ce28a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.30.0-wmf.16
Gerrit-Owner: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to