From: Bjornskjald Date: Wed, 21 Nov 2018 22:48:16 +0000 (+0100) Subject: Make "→" link to page section on History page larger by adding section name to it X-Git-Tag: 1.34.0-rc.0~3447 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/journal.php?a=commitdiff_plain;h=0a8e16d7cfe6ccc0d366c9b9435cb618209d46b0;p=lhc%2Fweb%2Fwiklou.git Make "→" link to page section on History page larger by adding section name to it Bug: T165189 Change-Id: I1f845592bd3de342fda84b60fc412055973950fd --- 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 ],