r52963 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52962‎ | r52963 | r52964 >
Date:03:50, 9 July 2009
Author:rememberthedot
Status:resolved (Comments)
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
@@ -2681,8 +2681,8 @@
26822682 !! input
26832683 {{includeonly section}}
26842684 !! result
2685 -<a name="Includeonly_section" id="Includeonly_section"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline">Includeonly section</span></h2>
2686 -<a name="Section_T-1" id="Section_T-1"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline">Section T-1</span></h2>
 2685+<h2 id="Includeonly_section"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline">Includeonly section</span></h2>
 2686+<h2 id="Section_T-1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline">Section T-1</span></h2>
26872687
26882688 !! end
26892689
@@ -2708,7 +2708,7 @@
27092709 </includeonly>
27102710 ==Section 1==
27112711 !! result
2712 -<a name="Section_1" id="Section_1"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline">Section 1</span></h2>
 2712+<h2 id="Section_1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline">Section 1</span></h2>
27132713
27142714 !! end
27152715
@@ -3541,13 +3541,13 @@
35423542 ===Smaller headline===
35433543 Blah blah
35443544 !! result
3545 -<a name="Headline_1" id="Headline_1"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline"> Headline 1 </span></h2>
 3545+<h2 id="Headline_1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline"> Headline 1 </span></h2>
35463546 <p>Some text
35473547 </p>
3548 -<a name="Headline_2" id="Headline_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline">Headline 2</span></h2>
 3548+<h2 id="Headline_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline">Headline 2</span></h2>
35493549 <p>More
35503550 </p>
3551 -<a name="Smaller_headline" id="Smaller_headline"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline">Smaller headline</span></h3>
 3551+<h3 id="Smaller_headline"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline">Smaller headline</span></h3>
35523552 <p>Blah blah
35533553 </p>
35543554 !! end
@@ -3586,14 +3586,14 @@
35873587 </li>
35883588 </ul>
35893589 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3590 -<a name="Headline_1" id="Headline_1"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline"> Headline 1 </span></h2>
3591 -<a name="Subheadline_1" id="Subheadline_1"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline"> Subheadline 1 </span></h3>
3592 -<a name="Skipping_a_level" id="Skipping_a_level"></a><h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline"> Skipping a level </span></h5>
3593 -<a name="Skipping_a_level_2" id="Skipping_a_level_2"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline"> Skipping a level </span></h6>
3594 -<a name="Headline_2" id="Headline_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline"> Headline 2 </span></h2>
 3590+<h2 id="Headline_1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline"> Headline 1 </span></h2>
 3591+<h3 id="Subheadline_1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline"> Subheadline 1 </span></h3>
 3592+<h5 id="Skipping_a_level"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline"> Skipping a level </span></h5>
 3593+<h6 id="Skipping_a_level_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline"> Skipping a level </span></h6>
 3594+<h2 id="Headline_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline"> Headline 2 </span></h2>
35953595 <p>Some text
35963596 </p>
3597 -<a name="Another_headline" id="Another_headline"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline">Another headline</span></h3>
 3597+<h3 id="Another_headline"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline">Another headline</span></h3>
35983598
35993599 !! end
36003600
@@ -3641,16 +3641,16 @@
36423642 </li>
36433643 </ul>
36443644 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3645 -<a name="Level_1_Heading" id="Level_1_Heading"></a><h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline"> Level 1 Heading</span></h1>
3646 -<a name="Level_2_Heading" id="Level_2_Heading"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline"> Level 2 Heading</span></h2>
3647 -<a name="Level_3_Heading" id="Level_3_Heading"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline"> Level 3 Heading</span></h3>
3648 -<a name="Level_4_Heading" id="Level_4_Heading"></a><h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline"> Level 4 Heading</span></h4>
3649 -<a name="Level_5_Heading" id="Level_5_Heading"></a><h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline"> Level 5 Heading</span></h5>
3650 -<a name="Level_6_Heading" id="Level_6_Heading"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline"> Level 6 Heading</span></h6>
3651 -<a name=".3D_Level_7_Heading.3D" id=".3D_Level_7_Heading.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline">= Level 7 Heading=</span></h6>
3652 -<a name=".3D.3D_Level_8_Heading.3D.3D" id=".3D.3D_Level_8_Heading.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline">== Level 8 Heading==</span></h6>
3653 -<a name=".3D.3D.3D_Level_9_Heading.3D.3D.3D" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline">=== Level 9 Heading===</span></h6>
3654 -<a name=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline">==== Level 10 Heading====</span></h6>
 3645+<h1 id="Level_1_Heading"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline"> Level 1 Heading</span></h1>
 3646+<h2 id="Level_2_Heading"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline"> Level 2 Heading</span></h2>
 3647+<h3 id="Level_3_Heading"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline"> Level 3 Heading</span></h3>
 3648+<h4 id="Level_4_Heading"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline"> Level 4 Heading</span></h4>
 3649+<h5 id="Level_5_Heading"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline"> Level 5 Heading</span></h5>
 3650+<h6 id="Level_6_Heading"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline"> Level 6 Heading</span></h6>
 3651+<h6 id=".3D_Level_7_Heading.3D"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline">= Level 7 Heading=</span></h6>
 3652+<h6 id=".3D.3D_Level_8_Heading.3D.3D"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline">== Level 8 Heading==</span></h6>
 3653+<h6 id=".3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline">=== Level 9 Heading===</span></h6>
 3654+<h6 id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline">==== Level 10 Heading====</span></h6>
36553655
36563656 !! end
36573657
@@ -3683,12 +3683,12 @@
36843684 </li>
36853685 </ul>
36863686 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3687 -<a name="title_1" id="title_1"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline"> title 1 </span></h2>
3688 -<a name="title_1.1" id="title_1.1"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline"> title 1.1 </span></h3>
3689 -<a name="title_1.1.1" id="title_1.1.1"></a><h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline"> title 1.1.1 </span></h4>
3690 -<a name="title_1.2" id="title_1.2"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline"> title 1.2 </span></h3>
3691 -<a name="title_2" id="title_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline"> title 2 </span></h2>
3692 -<a name="title_2.1" id="title_2.1"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline"> title 2.1 </span></h3>
 3687+<h2 id="title_1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline"> title 1 </span></h2>
 3688+<h3 id="title_1.1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline"> title 1.1 </span></h3>
 3689+<h4 id="title_1.1.1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline"> title 1.1.1 </span></h4>
 3690+<h3 id="title_1.2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline"> title 1.2 </span></h3>
 3691+<h2 id="title_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline"> title 2 </span></h2>
 3692+<h3 id="title_2.1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline"> title 2.1 </span></h3>
36933693
36943694 !! end
36953695
@@ -3719,12 +3719,12 @@
37203720 </li>
37213721 </ul>
37223722 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3723 -<a name="title_1" id="title_1"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline"> title 1 </span></h2>
3724 -<a name="title_1.1" id="title_1.1"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline"> title 1.1 </span></h3>
3725 -<a name="title_1.1.1" id="title_1.1.1"></a><h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline"> title 1.1.1 </span></h4>
3726 -<a name="title_1.2" id="title_1.2"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline"> title 1.2 </span></h3>
3727 -<a name="title_2" id="title_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline"> title 2 </span></h2>
3728 -<a name="title_2.1" id="title_2.1"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline"> title 2.1 </span></h3>
 3723+<h2 id="title_1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline"> title 1 </span></h2>
 3724+<h3 id="title_1.1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline"> title 1.1 </span></h3>
 3725+<h4 id="title_1.1.1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline"> title 1.1.1 </span></h4>
 3726+<h3 id="title_1.2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline"> title 1.2 </span></h3>
 3727+<h2 id="title_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline"> title 2 </span></h2>
 3728+<h3 id="title_2.1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline"> title 2.1 </span></h3>
37293729
37303730 !! end
37313731
@@ -3734,8 +3734,8 @@
37353735 == Foo bar ==
37363736 == Foo bar ==
37373737 !! result
3738 -<a name="Foo_bar" id="Foo_bar"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
3739 -<a name="Foo_bar_2" id="Foo_bar_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
 3738+<h2 id="Foo_bar"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
 3739+<h2 id="Foo_bar_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
37403740
37413741 !! end
37423742
@@ -3745,8 +3745,8 @@
37463746 == Foo bar ==
37473747 == Foo Bar ==
37483748 !! result
3749 -<a name="Foo_bar" id="Foo_bar"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
3750 -<a name="Foo_Bar_2" id="Foo_Bar_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline"> Foo Bar </span></h2>
 3749+<h2 id="Foo_bar"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
 3750+<h2 id="Foo_Bar_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline"> Foo Bar </span></h2>
37513751
37523752 !! end
37533753
@@ -3765,10 +3765,10 @@
37663766 {{sections}}
37673767 ==Section 4==
37683768 !! result
3769 -<a name="Section_0" id="Section_0"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline">Section 0</span></h2>
3770 -<a name="Section_1" id="Section_1"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 1</span></h3>
3771 -<a name="Section_2" id="Section_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 2</span></h2>
3772 -<a name="Section_4" id="Section_4"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline">Section 4</span></h2>
 3769+<h2 id="Section_0"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline">Section 0</span></h2>
 3770+<h3 id="Section_1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 1</span></h3>
 3771+<h2 id="Section_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 2</span></h2>
 3772+<h2 id="Section_4"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline">Section 4</span></h2>
37733773
37743774 !! end
37753775
@@ -3779,8 +3779,8 @@
37803780 ==Section 1==
37813781 ==Section 2==
37823782 !! result
3783 -<a name="Section_1" id="Section_1"></a><h2> <span class="mw-headline">Section 1</span></h2>
3784 -<a name="Section_2" id="Section_2"></a><h2> <span class="mw-headline">Section 2</span></h2>
 3783+<h2 id="Section_1"> <span class="mw-headline">Section 1</span></h2>
 3784+<h2 id="Section_2"> <span class="mw-headline">Section 2</span></h2>
37853785
37863786 !! end
37873787
@@ -3789,7 +3789,7 @@
37903790 !! input
37913791 ==Section with a [[Main Page|link]] in it==
37923792 !! result
3793 -<a name="Section_with_a_link_in_it" id="Section_with_a_link_in_it"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline">Section with a <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
 3793+<h2 id="Section_with_a_link_in_it"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline">Section with a <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
37943794
37953795 !! end
37963796
@@ -3811,9 +3811,9 @@
38123812 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
38133813 </ul>
38143814 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3815 -<a name="title_1" id="title_1"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline"> title 1 </span></h2>
3816 -<a name="title_1.1" id="title_1.1"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline"> title 1.1 </span></h3>
3817 -<a name="title_2" id="title_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline"> title 2 </span></h2>
 3815+<h2 id="title_1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline"> title 1 </span></h2>
 3816+<h3 id="title_1.1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline"> title 1.1 </span></h3>
 3817+<h2 id="title_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline"> title 2 </span></h2>
38183818
38193819 !! end
38203820
@@ -4981,7 +4981,7 @@
49824982 == onmouseover= ==
49834983 http://__TOC__
49844984 !! result
4985 -<a name="onmouseover.3D" id="onmouseover.3D"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline"> onmouseover= </span></h2>
 4985+<h2 id="onmouseover.3D"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline"> onmouseover= </span></h2>
49864986 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
49874987 <ul>
49884988 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
@@ -4996,7 +4996,7 @@
49974997 ==a==
49984998 {| STYLE=__TOC__
49994999 !! result
5000 -<a name="a" id="a"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline">a</span></h2>
 5000+<h2 id="a"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline">a</span></h2>
50015001 <table style="&#95;_TOC&#95;_">
50025002 <tr><td></td></tr>
50035003 </table>
@@ -6579,7 +6579,7 @@
65806580 !! input
65816581 {{MediaWiki:Fake}}
65826582 !! result
6583 -<a name="header" id="header"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline">header</span></h2>
 6583+<h2 id="header"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline">header</span></h2>
65846584
65856585 !! end
65866586
@@ -6610,12 +6610,12 @@
66116611 </li>
66126612 </ul>
66136613 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6614 -<a name="2" id="2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
6615 -<a name="6" id="6"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline">6</span></h6>
6616 -<a name="3" id="3"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline">3</span></h3>
6617 -<a name="1" id="1"></a><h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline">1</span></h1>
6618 -<a name="5" id="5"></a><h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline">5</span></h5>
6619 -<a name="2_2" id="2_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
 6614+<h2 id="2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
 6615+<h6 id="6"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline">6</span></h6>
 6616+<h3 id="3"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline">3</span></h3>
 6617+<h1 id="1"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline">1</span></h1>
 6618+<h5 id="5"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline">5</span></h5>
 6619+<h2 id="2_2"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
66206620
66216621 !! end
66226622
@@ -6852,7 +6852,7 @@
68536853 !! input
68546854 == -{Naslov}- ==
68556855 !! result
6856 -<a name="-.7BNaslov.7D-" id="-.7BNaslov.7D-"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline"> Naslov </span></h2>
 6856+<h2 id="-.7BNaslov.7D-"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline"> Naslov </span></h2>
68576857
68586858 !! end
68596859
@@ -6991,7 +6991,7 @@
69926992 !! result
69936993 <p>[[link
69946994 </p>
6995 -<a name="heading" id="heading"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline">heading</span></h2>
 6995+<h2 id="heading"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline">heading</span></h2>
69966996
69976997 !! end
69986998
@@ -7003,7 +7003,7 @@
70047004 !! result
70057005 <p>{{foo|
70067006 </p>
7007 -<a name="heading" id="heading"></a><h1> <span class="mw-headline">heading</span></h1>
 7007+<h1 id="heading"> <span class="mw-headline">heading</span></h1>
70087008
70097009 !! end
70107010
@@ -7015,7 +7015,7 @@
70167016 !! result
70177017 <p>{{foo|
70187018 </p>
7019 -<a name="heading" id="heading"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline">heading</span></h2>
 7019+<h2 id="heading"><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline">heading</span></h2>
70207020
70217021 !! end
70227022
Index: trunk/phase3/includes/Linker.php
@@ -1266,13 +1266,12 @@
12671267 * @return string HTML headline
12681268 */
12691269 public function makeHeadline( $level, $attribs, $anchor, $text, $link, $legacyAnchor = false ) {
1270 - $ret = "<a name=\"$anchor\" id=\"$anchor\"></a>"
1271 - . "<h$level$attribs"
 1270+ $ret = "<h$level id=\"$anchor\"$attribs"
12721271 . $link
12731272 . " <span class=\"mw-headline\">$text</span>"
12741273 . "</h$level>";
12751274 if ( $legacyAnchor !== false ) {
1276 - $ret = "<a name=\"$legacyAnchor\" id=\"$legacyAnchor\"></a>$ret";
 1275+ $ret = "<a id=\"$legacyAnchor\"></a>$ret";
12771276 }
12781277 return $ret;
12791278 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r53033Remove stray name="" from anchors (cf. r52963)simetrical04:19, 10 July 2009
r53101Updated RELEASE-NOTES for r52963 and r53033rememberthedot05:00, 11 July 2009
r53577Follow-up to r52963: Moved ID attributes on header elements to the spans with...rememberthedot04:19, 21 July 2009

Comments

#Comment by GreenReaper (talk | contribs)   04:32, 9 July 2009

Some background to this on bug 19576.

#Comment by Simetrical (talk | contribs)   01:05, 10 July 2009

This should probably get a RELEASE-NOTES mention.

#Comment by Remember the dot (talk | contribs)   05:01, 11 July 2009

Done in r53101.

#Comment by Simetrical (talk | contribs)   00:17, 13 July 2009

This adds two id's to the h# element, if the header has a manually specified id. Like <h2 id=test>Foo</h2> becomes <h2 id="Foo" id="test">Foo</h2>. This needs to be dealt with somehow. Note that overriding the given id will break things: for instance, w:Main Page uses explicit id's on anchors.

#Comment by GreenReaper (talk | contribs)   01:01, 13 July 2009

Can we simply scan $attribs for an existing id attribute and avoid the default $anchor-based id if there is?

#Comment by Simetrical (talk | contribs)   01:11, 13 July 2009

What do you mean by avoiding it? The id needs to be somewhere. We could put it on the div instead of the actual header element, perhaps.

#Comment by GreenReaper (talk | contribs)   01:21, 13 July 2009

I was thinking that if they'd specified an id for the header, they probably didn't need the default id provided by the text - but I guess it could break things that expected them both to work.

Modifying the div seems a little hacky - what if something put an id on that? Maybe we could just fall back to the old <a id=\"$anchor\"></a>" for the situation where a custom id was detected in $attribs.

#Comment by Remember the dot (talk | contribs)   03:17, 13 July 2009

As long as the <h2> syntax creates an entry in the table of contents, it needs an ID (preferably attached directly to the h2 tag). For consistency, IDs should match the section titles. For example, <h2>Foo</h2> should become <h2 id="Foo">Foo</h2>. If editors want to be able to link to headers by other names, they can simply add span or anchor tags. For example, if the section "Foo" should be linkable by #Bar, the editor might write <span id="Bar"></span><h2>Foo</h2>. Templates can make this as easy as {{anchor|Bar}}<h2>Foo</h2>.

So, I recommend that we simply do not allow editors to add IDs directly to header tags. Editors that need unusual IDs for URL purposes can add them pretty easily with span or anchor tags.

#Comment by Simetrical (talk | contribs)   18:41, 13 July 2009

What's wrong with adding the TOC id to the div instead of the h# tag? That has the advantage of not breaking existing content.

#Comment by Remember the dot (talk | contribs)   05:23, 15 July 2009

All right, just so we're all clear, <h2>Foo</h2> produces

<h2 id="Foo"> <span class="mw-headline">Foo</span></h2>

The only problem I see with moving id="Foo" to <span class="mw-headline"> is that it would decrease the ID's usefulness a little. Without the editor adding more code, CSS would only be able to target the headline and not the header as a whole. Similar problems would crop up in JavaScript as well.

So, in the interest of flexibility, I think I'd rather keep it how it is, minus the ability for editors to add custom IDs to headers. Or maybe we could get the TOC to use the custom ID (if present) instead of the autogenerated one.

#Comment by Remember the dot (talk | contribs)   04:23, 21 July 2009

Actually, my favorite solution would be to have <h2>Foo</h2> output <h2>Foo</h2>, plain and simple. No edit link, no automatic ID, no entry in the table of contents.

But, since that would require a lot more work on the parser than I feel like doing, let's just go with your solution for now. Committed in r53577.

#Comment by Simetrical (talk | contribs)   09:42, 21 July 2009

I always thought that too, but it would break compatibility at this point somewhat severely.

#Comment by Simetrical (talk | contribs)   18:39, 13 July 2009

You can't put an id on the div. There's no syntax for it, since the div is generated by the software.

#Comment by Brion VIBBER (talk | contribs)   18:56, 22 August 2009

AFAIK outstanding problems have been resolved in later commits.

Status & tagging log