From 9fae5055fa792c355d71524b8606636835cea104 Mon Sep 17 00:00:00 2001 From: Remember the dot Date: Thu, 9 Jul 2009 03:50:49 +0000 Subject: [PATCH] Removed redundant anchors from headings as suggested by Aryeh Gregor on wikitech-l. Even IE6 supports jumping to elements by ID using URLs, so there is no need to make this any more complicated than it has to be. --- includes/Linker.php | 5 +- maintenance/parserTests.txt | 122 ++++++++++++++++++------------------ 2 files changed, 63 insertions(+), 64 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index 2a77edb6db..02e4790aeb 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1266,13 +1266,12 @@ class Linker { * @return string HTML headline */ public function makeHeadline( $level, $attribs, $anchor, $text, $link, $legacyAnchor = false ) { - $ret = "" - . "$text" . ""; if ( $legacyAnchor !== false ) { - $ret = "$ret"; + $ret = "$ret"; } return $ret; } diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index acb3c1899a..3771941b6c 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -2681,8 +2681,8 @@ Bug 6563: Edit link generation for section shown by !! input {{includeonly section}} !! result -

[edit] Includeonly section

-

[edit] Section T-1

+

[edit] Includeonly section

+

[edit] Section T-1

!! end @@ -2708,7 +2708,7 @@ Bug 6563: Edit link generation for section suppressed by ==Section 1== !! result -

[edit] Section 1

+

[edit] Section 1

!! end @@ -3541,13 +3541,13 @@ More ===Smaller headline=== Blah blah !! result -

[edit] Headline 1

+

[edit] Headline 1

Some text

-

[edit] Headline 2

+

[edit] Headline 2

More

-

[edit] Smaller headline

+

[edit] Smaller headline

Blah blah

!! end @@ -3586,14 +3586,14 @@ Some text -

[edit] Headline 1

-

[edit] Subheadline 1

-
[edit] Skipping a level
-
[edit] Skipping a level
-

[edit] Headline 2

+

[edit] Headline 1

+

[edit] Subheadline 1

+
[edit] Skipping a level
+
[edit] Skipping a level
+

[edit] Headline 2

Some text

-

[edit] Another headline

+

[edit] Another headline

!! end @@ -3641,16 +3641,16 @@ Handling of sections up to level 6 and beyond -

[edit] Level 1 Heading

-

[edit] Level 2 Heading

-

[edit] Level 3 Heading

-

[edit] Level 4 Heading

-
[edit] Level 5 Heading
-
[edit] Level 6 Heading
-
[edit] = Level 7 Heading=
-
[edit] == Level 8 Heading==
-
[edit] === Level 9 Heading===
-
[edit] ==== Level 10 Heading====
+

[edit] Level 1 Heading

+

[edit] Level 2 Heading

+

[edit] Level 3 Heading

+

[edit] Level 4 Heading

+
[edit] Level 5 Heading
+
[edit] Level 6 Heading
+
[edit] = Level 7 Heading=
+
[edit] == Level 8 Heading==
+
[edit] === Level 9 Heading===
+
[edit] ==== Level 10 Heading====
!! end @@ -3683,12 +3683,12 @@ TOC regression (bug 9764) -

[edit] title 1

-

[edit] title 1.1

-

[edit] title 1.1.1

-

[edit] title 1.2

-

[edit] title 2

-

[edit] title 2.1

+

[edit] title 1

+

[edit] title 1.1

+

[edit] title 1.1.1

+

[edit] title 1.2

+

[edit] title 2

+

[edit] title 2.1

!! end @@ -3719,12 +3719,12 @@ wgMaxTocLevel=3 -

[edit] title 1

-

[edit] title 1.1

-

[edit] title 1.1.1

-

[edit] title 1.2

-

[edit] title 2

-

[edit] title 2.1

+

[edit] title 1

+

[edit] title 1.1

+

[edit] title 1.1.1

+

[edit] title 1.2

+

[edit] title 2

+

[edit] title 2.1

!! end @@ -3734,8 +3734,8 @@ Resolving duplicate section names == Foo bar == == Foo bar == !! result -

[edit] Foo bar

-

[edit] Foo bar

+

[edit] Foo bar

+

[edit] Foo bar

!! end @@ -3745,8 +3745,8 @@ Resolving duplicate section names with differing case (bug 10721) == Foo bar == == Foo Bar == !! result -

[edit] Foo bar

-

[edit] Foo Bar

+

[edit] Foo bar

+

[edit] Foo Bar

!! end @@ -3765,10 +3765,10 @@ __NOTOC__ {{sections}} ==Section 4== !! result -

[edit] Section 0

-

[edit] Section 1

-

[edit] Section 2

-

[edit] Section 4

+

[edit] Section 0

+

[edit] Section 1

+

[edit] Section 2

+

[edit] Section 4

!! end @@ -3779,8 +3779,8 @@ __NOEDITSECTION__ ==Section 1== ==Section 2== !! result -

Section 1

-

Section 2

+

Section 1

+

Section 2

!! end @@ -3789,7 +3789,7 @@ Link inside a section heading !! input ==Section with a [[Main Page|link]] in it== !! result -

[edit] Section with a link in it

+ !! end @@ -3811,9 +3811,9 @@ __TOC__
  • 2 title 2
  • -

    [edit] title 1

    -

    [edit] title 1.1

    -

    [edit] title 2

    +

    [edit] title 1

    +

    [edit] title 1.1

    +

    [edit] title 2

    !! end @@ -4981,7 +4981,7 @@ Fuzz testing: Parser14 == onmouseover= == http://__TOC__ !! result -

    [edit] onmouseover=

    +

    [edit] onmouseover=

    http://

    Contents

    • 1 onmouseover=
    • @@ -4996,7 +4996,7 @@ Fuzz testing: Parser14-table ==a== {| STYLE=__TOC__ !! result -

      [edit] a

      +

      [edit] a

      @@ -6579,7 +6579,7 @@ Inclusion of !userCanEdit() content !! input {{MediaWiki:Fake}} !! result -

      [edit] header

      + !! end @@ -6610,12 +6610,12 @@ Out-of-order TOC heading levels
    -

    [edit] 2

    -
    [edit] 6
    -

    [edit] 3

    -

    [edit] 1

    -
    [edit] 5
    -

    [edit] 2

    +

    [edit] 2

    +
    [edit] 6
    +

    [edit] 3

    +

    [edit] 1

    +
    [edit] 5
    +

    [edit] 2

    !! end @@ -6852,7 +6852,7 @@ language=sr variant=sr-ec !! input == -{Naslov}- == !! result -

    [уреди] Naslov

    +

    [уреди] Naslov

    !! end @@ -6991,7 +6991,7 @@ Morwen/13: Unclosed link followed by heading !! result

    [[link

    -

    [edit] heading

    +

    [edit] heading

    !! end @@ -7003,7 +7003,7 @@ HHP2.1: Heuristics for headings in preprocessor parenthetical structures !! result

    {{foo|

    -

    heading

    +

    heading

    !! end @@ -7015,7 +7015,7 @@ HHP2.2: Heuristics for headings in preprocessor parenthetical structures !! result

    {{foo|

    -

    [edit] heading

    +

    [edit] heading

    !! end -- 2.20.1