From e687f2da3eb5be95855d9aafc53a7524dfaefa34 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 1 Sep 2017 00:36:41 +0000 Subject: [PATCH] Revert "Fix link prefix/suffixes around Category and Language links." This reverts commit c66c9aa5352743b2f87bc4627a1be529c5d18535. Bug: T174639 Change-Id: Ibf6d3780f384ba8edc80bf28c893f1aee8ce28a8 --- includes/parser/Parser.php | 16 +++++++--------- tests/parser/parserTests.txt | 34 ---------------------------------- 2 files changed, 7 insertions(+), 43 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 5ef0032f53..326100280d 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2323,11 +2323,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; } @@ -2352,11 +2349,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(); @@ -2368,6 +2361,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; } } diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 2fa3cb05d0..ab79b59409 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -15807,26 +15807,6 @@ parsoid=wt2html !! end -!! test -9. Categories and newlines: should behave properly with linkprefix (T87753) -!! options -language=ar -!! wikitext -foo bar -foo bar -[[تصنيف:Foo]] -[[تصنيف:Bar]] -!! html/php -

foo bar -foo bar -

-!! html/parsoid -

foo bar -foo bar

- - -!! end - !! test Category links with multiple namespaces !! wikitext @@ -15874,20 +15854,6 @@ x[[Category:Foo]]y

xy

!! end -!! test -Link prefix/suffixes aren't applied to language links -!! options -parsoid=wt2html -language=is -!! wikitext -x[[es:Foo]]y -!! html/php -

xy -

-!! html/parsoid -

xy

-!! end - !! test Parsoid: Serialize link to file page with colon escape !! options -- 2.20.1