From: Max Semenik Date: Thu, 3 Aug 2017 21:56:59 +0000 (-0700) Subject: Move section ID fallbacks into headers themselves X-Git-Tag: 1.31.0-rc.0~2245^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=4f2eed6877938c3c7703072567e62b933c07b4b5 Move section ID fallbacks into headers themselves Per feeedback on T152540. Now there's an uniform way to get to section's from element with the given ID. Change-Id: I94b46707dadb1988d963344b02060dcaffdab7b4 --- diff --git a/includes/Linker.php b/includes/Linker.php index 2ca851c13f..33e30c9b24 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1619,14 +1619,16 @@ class Linker { $link, $fallbackAnchor = false ) { $anchorEscaped = htmlspecialchars( $anchor ); - $ret = "$html" - . $link - . ""; + $fallback = ''; if ( $fallbackAnchor !== false && $fallbackAnchor !== $anchor ) { $fallbackAnchor = htmlspecialchars( $fallbackAnchor ); - $ret = "
$ret"; + $fallback = ""; } + $ret = "$html" + . $link + . ""; + return $ret; } diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index ab79b59409..82d195a653 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -28424,10 +28424,10 @@ wgFragmentMode=[ 'html5', 'legacy' ]

Foo bar[edit]

foo Bar[edit]

-

Тест[edit]

-

Тест[edit]

-

тест[edit]

-

Hey < # " > % : '[edit]

+

Тест[edit]

+

Тест[edit]

+

тест[edit]

+

Hey < # " > % : '[edit]

#Foo bar #foo Bar #Тест #тест #Hey < # " > % : '

%F0%9F%92%A9

#啤酒 #啤酒 @@ -28471,10 +28471,10 @@ wgFragmentMode=[ 'legacy', 'html5' ]

Foo bar[edit]

foo Bar[edit]

-

Тест[edit]

-

Тест[edit]

-

тест[edit]

-

Hey < # " > % : '[edit]

+

Тест[edit]

+

Тест[edit]

+

тест[edit]

+

Hey < # " > % : '[edit]

#Foo bar #foo Bar #Тест #тест #Hey < # " > % : '

.F0.9F.92.A9

#啤酒 #啤酒