C. Scott Ananian has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/376872 )
Change subject: Remove "only newlines in trailer" special case for category/language links ...................................................................... Remove "only newlines in trailer" special case for category/language links This special case complicates wikitext semantics and ought to be unnecessary. Parsoid doesn't include this special case; if this patch to the PHP parser isn't merged, we should write one for Parsoid to implement the missing special case logic. Bug: T175416 Change-Id: I3865c51b21de9d63ac5d06dcc3a3fa9108129d6c --- M includes/parser/Parser.php M tests/parser/parserTests.txt 2 files changed, 7 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/72/376872/1 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 0d11d5a..fe8622a 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2299,10 +2299,7 @@ /** * Strip the whitespace interwiki links produce, see T10897 */ - $s = rtrim( $s . $prefix ); - // Special case: strip newlines when only thing between - // this link and next are newlines - $s .= trim( $trail, "\n" ) === '' ? '' : $trail; + $s = rtrim( $s . $prefix ) . $trail; # T175416 continue; } @@ -2330,10 +2327,7 @@ /** * Strip the whitespace Category links produce, see T2087 */ - $s = rtrim( $s . $prefix ); # T2087, T87753 - // Special case: strip newlines when only thing between - // this link and next are newlines - $s .= trim( $trail, "\n" ) === '' ? '' : $trail; + $s = rtrim( $s . $prefix ) . $trail; # T2087, T87753 if ( $wasblank ) { $sortkey = $this->getDefaultSort(); diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index ca16738..9a08b47 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -16140,11 +16140,9 @@ <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div> !! end -# NOTE that Parsoid does not currently implement this special case -# (T175416). The plan is to remove this weird special-case in the PHP -# parser to make it match the Parsoid output. +# Note that Parsoid differs slightly from PHP due to T175421 !! test -11. Special case where only newlines separate links +11. Special case where only newlines separate links (T175416) !! options parsoid=wt2html,html2html !! wikitext @@ -16154,7 +16152,9 @@ [[Foo]] !! html/php -<p><a href="/wiki/Foo" title="Foo">Foo</a><a href="/wiki/Foo" title="Foo">Foo</a> +<p><br /> +<a href="/wiki/Foo" title="Foo">Foo</a> +</p><p><a href="/wiki/Foo" title="Foo">Foo</a> </p> !! html/parsoid <link rel="mw:PageProp/Category" href="./Category:Foo"/> -- To view, visit https://gerrit.wikimedia.org/r/376872 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3865c51b21de9d63ac5d06dcc3a3fa9108129d6c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits