From 8e2b52b80cf7c9913f81b0898080a322d74c44f1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 1 Jan 2009 00:46:22 +0000 Subject: [PATCH] Partial revert of r45109, r45116 -- removing the forced 'x' prefix from IDs not beginning with letters. Since we're probably going to change all our section fragments to something nicer in the next couple weeks, and nothing seems to actually explode based on what we're doing so far, I'd rather leave them be for now rather than break existing section links. --- includes/Sanitizer.php | 7 ++++++ maintenance/parserTests.txt | 46 ++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index a315ed4cd3..6caded3d73 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -802,11 +802,18 @@ class Sanitizer { $id = urlencode( Sanitizer::decodeCharReferences( strtr( $id, ' ', '_' ) ) ); $id = str_replace( array_keys( $replace ), array_values( $replace ), $id ); + /* + // Let's not go changing our links just yet, since we plan to + // rip this out anyway and switch to the prettier Unicode-friendly + // links as XHTML and HTML 5 allow and browsers seem to think is + // just a-ok to do. + // if ( !preg_match( '/^[a-zA-Z]/', $id ) && !in_array( 'noninitial', $options ) ) { // Initial character must be a letter! $id = "x$id"; } + */ return $id; } diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index a30db63492..44fe01f2d1 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 @@ -3607,10 +3607,10 @@ Handling of sections up to level 6 and beyond
  • 1.1.1.1.1 Level 5 Heading
  • @@ -3629,10 +3629,10 @@ Handling of sections up to level 6 and beyond

    [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 7 Heading=
    +
    [edit] == Level 8 Heading==
    +
    [edit] === Level 9 Heading===
    +
    [edit] ==== Level 10 Heading====
    !! end @@ -4662,7 +4662,7 @@ Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id= !! input byte[[#æ: v|backlink]] !! result -

    bytebacklink +

    bytebacklink

    !! end @@ -6578,26 +6578,26 @@ Out-of-order TOC heading levels !! result

    Contents

    -

    [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 @@ -6843,7 +6843,7 @@ language=sr variant=sr-ec !! input == -{Naslov}- == !! result -

    [уреди] Naslov

    +

    [уреди] Naslov

    !! end -- 2.20.1