From: Aryeh Gregor Date: Sun, 28 Dec 2008 03:31:21 +0000 (+0000) Subject: Polish up r45109 (changes to header id generation) X-Git-Tag: 1.31.0-rc.0~43730 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=739b6549393288d864d71c0e369f68dde5964383;p=lhc%2Fweb%2Fwiklou.git Polish up r45109 (changes to header id generation) 1) Make sure internal links are using the new encoding scheme and still work (this also reduces code duplication) 2) Make sure no id can start with a nonletter, not just header id's No parser test regressions. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 62cd3b62d4..8f3d1301c8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -457,7 +457,7 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 13835) Fix rendering of {{filepath:Wiki.png|nowiki}} * (bug 16772) Special:Upload now correctly rejects files with spaces in the file extension (e.g. Foo. jpg). -* Ensure that all HTML id's generated for headers begin with a letter. +* Ensure that all HTML id's begin with a letter as required by XHTML standard === API changes in 1.14 === diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 84cc7f8e6c..28ae4cb424 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -617,7 +617,7 @@ class Sanitizer { } if ( $attribute === 'id' ) - $value = Sanitizer::escapeId( $value ); + $value = Sanitizer::escapeId( $value, Sanitizer::NONE ); // If this attribute was previously set, override it. // Output should only have one attribute of each name. diff --git a/includes/Title.php b/includes/Title.php index 4f82e95105..abfae90847 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -451,13 +451,7 @@ class Title { * Escape a text fragment, say from a link, for a URL */ static function escapeFragmentForURL( $fragment ) { - $fragment = str_replace( ' ', '_', $fragment ); - $fragment = urlencode( Sanitizer::decodeCharReferences( $fragment ) ); - $replaceArray = array( - '%3A' => ':', - '%' => '.' - ); - return strtr( $fragment, $replaceArray ); + return Sanitizer::escapeId( $fragment, Sanitizer::NONE ); } #---------------------------------------------------------------------------- diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 8e514e4737..a30db63492 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1454,7 +1454,7 @@ Example for such a section: == < == !! input [[%23%3c]][[%23%3e]] !! result -

#<#> +

#<#>

!! end @@ -4662,7 +4662,7 @@ Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id= !! input byte[[#æ: v|backlink]] !! result -

bytebacklink +

bytebacklink

!! end