From 0a8e16d7cfe6ccc0d366c9b9435cb618209d46b0 Mon Sep 17 00:00:00 2001 From: Bjornskjald Date: Wed, 21 Nov 2018 23:48:16 +0100 Subject: [PATCH] =?utf8?q?Make=20"=E2=86=92"=20link=20to=20page=20section?= =?utf8?q?=20on=20History=20page=20larger=20by=20adding=20section=20name?= =?utf8?q?=20to=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Bug: T165189 Change-Id: I1f845592bd3de342fda84b60fc412055973950fd --- includes/Linker.php | 14 +++++++++----- tests/parser/parserTests.txt | 8 ++++---- tests/phpunit/includes/LinkerTest.php | 26 +++++++++++++------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index 0ecd744c9e..7eda21bce1 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1168,7 +1168,10 @@ class Linker { $title->getDBkey(), $section ); } if ( $sectionTitle ) { - $link = Linker::makeCommentLink( $sectionTitle, $wgLang->getArrow(), $wikiId, 'noclasses' ); + $link = Linker::makeCommentLink( + $sectionTitle, $wgLang->getArrow() . $auto, $wikiId, 'noclasses' + ); + $auto = ''; } else { $link = ''; } @@ -1181,10 +1184,11 @@ class Linker { # autocomment $postsep written summary (/* section */ summary) $auto .= wfMessage( 'colon-separator' )->inContentLanguage()->escaped(); } - $auto = '' . $auto . ''; - $comment = $pre . $link . $wgLang->getDirMark() - . '' . $auto; - $append .= ''; + if ( $auto ) { + $auto = '' . $auto . ''; + $append .= ''; + } + $comment = $pre . $link . $wgLang->getDirMark() . $auto; } return $comment; }, diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 6d5054e6ce..e034fec58d 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -24422,7 +24422,7 @@ comment title=[[Main Page]] !! wikitext /* External links */ removed bogus entries !! html/php -→‎External links: removed bogus entries +→External links‎: removed bogus entries !!end !! test @@ -24432,7 +24432,7 @@ comment title=[[Main Page]] !! wikitext pre-comment text /* External links */ removed bogus entries !! html/php -pre-comment text →‎External links: removed bogus entries +pre-comment text →External links‎: removed bogus entries !!end !! test @@ -24442,7 +24442,7 @@ comment local title=[[Main Page]] !! wikitext /* External links */ removed bogus entries !! html/php -→‎External links: removed bogus entries +→External links‎: removed bogus entries !!end !! test @@ -24553,7 +24553,7 @@ title=[[Main Page]] !! wikitext /* __hello__world__ */ !! html/php -→‎__hello__world__ +→__hello__world__‎ !! end !! test diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index b8aecc05a5..52a3c914fb 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -152,43 +152,43 @@ class LinkerTest extends MediaWikiLangTestCase { ], // Linker::formatAutocomments [ - '→‎autocomment', + '→autocomment‎', "/* autocomment */", ], [ - '→‎linkie?', + '→linkie?‎', "/* [[linkie?]] */", ], [ - '→‎autocomment: post', + '→autocomment‎: post', "/* autocomment */ post", ], [ - 'pre →‎autocomment', + 'pre →autocomment‎', "pre /* autocomment */", ], [ - 'pre →‎autocomment: post', + 'pre →autocomment‎: post', "pre /* autocomment */ post", ], [ - '→‎autocomment: multiple? →‎autocomment2: ', - "/* autocomment */ multiple? /* autocomment2 */ ", + '→autocomment‎: multiple? →autocomment2‎', + "/* autocomment */ multiple? /* autocomment2 */", ], [ - '→‎autocomment containing /*: T70361', + '→autocomment containing /*‎: T70361', "/* autocomment containing /* */ T70361" ], [ - '→‎autocomment containing "quotes"', + '→autocomment containing "quotes"‎', "/* autocomment containing \"quotes\" */" ], [ - '→‎autocomment containing <script>tags</script>', + '→autocomment containing <script>tags</script>‎', "/* autocomment containing */" ], [ - '→‎autocomment', + '→autocomment‎', "/* autocomment */", false, true ], @@ -198,12 +198,12 @@ class LinkerTest extends MediaWikiLangTestCase { null ], [ - '→‎autocomment', + '→autocomment‎', "/* autocomment */", false, false ], [ - '→‎autocomment', + '→autocomment‎', "/* autocomment */", false, false, $wikiId ], -- 2.20.1