From: Kunal Mehta Date: Sat, 1 Dec 2018 08:47:03 +0000 (-0800) Subject: Restore old HTML structure for history section links X-Git-Tag: 1.34.0-rc.0~3352^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=0c9cf24b056bcdf466fe03807d13785c24993c72;p=lhc%2Fweb%2Fwiklou.git Restore old HTML structure for history section links A follow-up to 0a8e16d7cfe6c thanks to Anomie's code review. The section title is now inside and , as before. $wgLang->getDirMark() between the arrow and the text was restored. Given the comment /* External links */ removed bogus entries the HTML before 0a8e16d7cfe6c looked like: External links: removed bogus entries after this change, it will look like: →‎External links: removed bogus entries The issue of having links be inside other links will be addressed in a separate patch. Bug: T165189 Change-Id: I31d87a87ccaf50de58fdd0621c46133b2881b490 --- diff --git a/includes/Linker.php b/includes/Linker.php index 7eda21bce1..e96d8d84af 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1151,7 +1151,6 @@ class Linker { ); if ( $comment === null ) { - $link = ''; if ( $title ) { $section = $auto; # Remove links that a user may have manually put in the autosummary @@ -1168,12 +1167,10 @@ class Linker { $title->getDBkey(), $section ); } if ( $sectionTitle ) { - $link = Linker::makeCommentLink( - $sectionTitle, $wgLang->getArrow() . $auto, $wikiId, 'noclasses' + $auto = Linker::makeCommentLink( + $sectionTitle, $wgLang->getArrow() . $wgLang->getDirMark() . $auto, + $wikiId, 'noclasses' ); - $auto = ''; - } else { - $link = ''; } } if ( $pre ) { @@ -1188,7 +1185,7 @@ class Linker { $auto = '' . $auto . ''; $append .= ''; } - $comment = $pre . $link . $wgLang->getDirMark() . $auto; + $comment = $pre . $auto; } return $comment; }, diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index d65e49aa87..bbacfafc64 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -24502,7 +24502,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 @@ -24512,7 +24512,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 @@ -24522,7 +24522,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 @@ -24633,7 +24633,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 52a3c914fb..1f8f4385e9 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -152,58 +152,58 @@ 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 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 ], [ - '‎autocomment', + 'autocomment', "/* autocomment */", null ], [ - '→autocomment‎', + '→‎autocomment', "/* autocomment */", false, false ], [ - '→autocomment‎', + '→‎autocomment', "/* autocomment */", false, false, $wikiId ],