$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;
}
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();
$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;
}
}
<link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
!! 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
<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
Parsoid: Serialize link to file page with colon escape
!! options