diff options
-rw-r--r-- | RELEASE-NOTES | 3 | ||||
-rw-r--r-- | includes/Parser.php | 9 | ||||
-rw-r--r-- | maintenance/parserTests.txt | 11 |
3 files changed, 21 insertions, 2 deletions
diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8100b84fc10d..c2888ad7a34a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -81,6 +81,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN case-insensitive names. * Adding the fix for lists in RTL wikis to more skins, and fixing the image toc * (bug 8157) Remove redirects from Special:Unusedtemplates. Patch by WebBoy. +* (bug 10721) Duplicate section anchors with differing case now disambiguated + for Internet Explorer's sake + === API changes in 1.13 === diff --git a/includes/Parser.php b/includes/Parser.php index acefb8dcaa12..ef4e2a1ed9ae 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3494,11 +3494,16 @@ class Parser # Save headline for section edit hint before it's escaped $headlineHint = $safeHeadline; $safeHeadline = Sanitizer::escapeId( $safeHeadline ); + # lowercase headline, since some browser don't distinguish + # "Anchor" from "anchor" (bug #10721) + $arrayKey = strtolower( $safeHeadline ); + + # XXX : Is $refers[$headlineCount] ever accessed, actually ? $refers[$headlineCount] = $safeHeadline; # count how many in assoc. array so we can track dupes in anchors - isset( $refers[$safeHeadline] ) ? $refers[$safeHeadline]++ : $refers[$safeHeadline] = 1; - $refcount[$headlineCount] = $refers[$safeHeadline]; + isset( $refers[$arrayKey] ) ? $refers[$arrayKey]++ : $refers[$arrayKey] = 1; + $refcount[$headlineCount] = $refers[$arrayKey]; # Don't number the heading if it is the only one (looks silly) if( $doNumberHeadings && count( $matches[3] ) > 1) { diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index fb9708a2c7bc..2e72415c813e 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -3551,6 +3551,17 @@ Resolving duplicate section names !! end +!! test +Resolving duplicate section names with differing case (bug 10721) +!! input +== Foo bar == +== Foo Bar == +!! result +<a name="Foo_bar"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2> +<a name="Foo_Bar_2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline"> Foo Bar </span></h2> + +!! end + !! article Template:sections !! text |