From d68c89cfd139139768d23c95d473f657b409fab0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 12 Jun 2006 05:33:48 +0000 Subject: [PATCH] * Use double quoted consistently on attributes in linker output; preparing for new normalization code when tidy not in use --- RELEASE-NOTES | 2 + includes/Linker.php | 14 +-- maintenance/parserTests.txt | 216 ++++++++++++++++++------------------ 3 files changed, 117 insertions(+), 115 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index eceb7dd795..7d89b45730 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -474,6 +474,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Update to Latin translation (la) * Update to Dutch translation (nl) * Avoid some notices in page history with bad input +* Use double quoted consistently on attributes in linker output; preparing + for new normalization code when tidy not in use == Compatibility == diff --git a/includes/Linker.php b/includes/Linker.php index 8a1946261e..887edbebb1 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -30,7 +30,7 @@ class Linker { function getExternalLinkAttributes( $link, $text, $class='' ) { $link = htmlspecialchars( $link ); - $r = ($class != '') ? " class='$class'" : " class='external'"; + $r = ($class != '') ? " class=\"$class\"" : " class=\"external\""; $r .= " title=\"{$link}\""; return $r; @@ -45,7 +45,7 @@ class Linker { $link = preg_replace( '/[\\x00-\\x1f]/', ' ', $link ); $link = htmlspecialchars( $link ); - $r = ($class != '') ? " class='$class'" : " class='external'"; + $r = ($class != '') ? " class=\"$class\"" : " class=\"external\""; $r .= " title=\"{$link}\""; return $r; @@ -721,7 +721,7 @@ class Linker { $text = $alt; } $u = htmlspecialchars( $url ); - return "{$text}"; + return "{$text}"; } } @@ -966,7 +966,7 @@ class Linker { return ''; } else { $formatted = $this->formatComment( $comment, $title ); - return " ($formatted)"; + return " ($formatted)"; } } @@ -980,11 +980,11 @@ class Linker { if( $rev->userCan( Revision::MW_REV_DELETED_COMMENT ) ) { $block = $this->commentBlock( $rev->getRawComment(), $rev->getTitle() ); } else { - $block = " " . + $block = " " . wfMsgHtml( 'rev-deleted-comment' ) . ""; } if( $rev->isDeleted( Revision::MW_REV_DELETED_COMMENT ) ) { - return " $block"; + return " $block"; } return $block; } @@ -1003,7 +1003,7 @@ class Linker { * parameter level defines if we are on an indentation level */ function tocLine( $anchor, $tocline, $tocnumber, $level ) { - return "\n
  • ' . $tocnumber . ' ' . $tocline . ''; diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index c4f944684c..d237fc6403 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -401,7 +401,7 @@ Definition list with URL link !! input ; http://example.com/ : definition !! result -
    http://example.com/ 
    definition +
    http://example.com/ 
    definition
    !! end @@ -411,7 +411,7 @@ Definition list with bracketed URL link !! input ;[http://www.example.com/ Example]:Something about it !! result -
    Example
    Something about it +
    Example
    Something about it
    !! end @@ -432,7 +432,7 @@ Definition list with wikilink containing colon !! input ; news:alt.wikipedia.rox: This isn't even a real newsgroup! !! result -
    news:alt.wikipedia.rox
    This isn't even a real newsgroup! +
    news:alt.wikipedia.rox
    This isn't even a real newsgroup!
    !! end @@ -442,7 +442,7 @@ Malformed definition list with colon !! input ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop !! result -
    news:alt.wikipedia.rox -- don't crash or enter an infinite loop +
    news:alt.wikipedia.rox -- don't crash or enter an infinite loop
    !! end @@ -452,7 +452,7 @@ Definition lists: colon in external link text !! input ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up !! result -
    Wikipedia : The Next Generation
    OK, I made that up +
    Wikipedia : The Next Generation
    OK, I made that up
    !! end @@ -487,7 +487,7 @@ External links: non-bracketed !! input Non-bracketed: http://example.com !! result -

    Non-bracketed: http://example.com +

    Non-bracketed: http://example.com

    !! end @@ -498,9 +498,9 @@ Numbered: [http://example.com] Numbered: [http://example.net] Numbered: [http://example.org] !! result -

    Numbered: [1] -Numbered: [2] -Numbered: [3] +

    Numbered: [1] +Numbered: [2] +Numbered: [3]

    !!end @@ -509,7 +509,7 @@ External links: specified text !! input Specified text: [http://example.com link] !! result -

    Specified text: link +

    Specified text: link

    !!end @@ -518,7 +518,7 @@ External links: trail !! input Linktrails should not work for external links: [http://example.com link]s !! result -

    Linktrails should not work for external links: links +

    Linktrails should not work for external links: links

    !! end @@ -527,7 +527,7 @@ External links: dollar sign in URL !! input http://example.com/1$2345 !! result -

    http://example.com/1$2345 +

    http://example.com/1$2345

    !! end @@ -536,7 +536,7 @@ External links: dollar sign in URL (named) !! input [http://example.com/1$2345] !! result -

    [1] +

    [1]

    !!end @@ -545,7 +545,7 @@ External links: open square bracket forbidden in URL (bug 4377) !! input http://example.com/1[2345 !! result -

    http://example.com/1[2345 +

    http://example.com/1[2345

    !! end @@ -554,7 +554,7 @@ External links: open square bracket forbidden in URL (named) (bug 4377) !! input [http://example.com/1[2345] !! result -

    [2345 +

    [2345

    !!end @@ -563,7 +563,7 @@ External links: nowiki in URL link text (bug 6230) !!input [http://example.com/ ''example site''] !! result -

    ''example site'' +

    ''example site''

    !! end @@ -573,7 +573,7 @@ External links: newline forbidden in text (bug 6230 regression check) [http://example.com/ first second] !! result -

    [http://example.com/ first +

    [http://example.com/ first second]

    !!end @@ -601,7 +601,7 @@ Link to non-http image, no img tag !! input Link to non-http image, no img tag: ftp://example.com/test.jpg !! result -

    Link to non-http image, no img tag: ftp://example.com/test.jpg +

    Link to non-http image, no img tag: ftp://example.com/test.jpg

    !! end @@ -610,7 +610,7 @@ External links: terminating separator !! input Terminating separator: http://example.com/thing, !! result -

    Terminating separator: http://example.com/thing, +

    Terminating separator: http://example.com/thing,

    !! end @@ -619,7 +619,7 @@ External links: intervening separator !! input Intervening separator: http://example.com/1,2,3 !! result -

    Intervening separator: http://example.com/1,2,3 +

    Intervening separator: http://example.com/1,2,3

    !! end @@ -628,7 +628,7 @@ External links: old bug with URL in query !! input Old bug with URL in query: [http://example.com/thing?url=http://example.com link] !! result -

    Old bug with URL in query: link +

    Old bug with URL in query: link

    !! end @@ -637,7 +637,7 @@ External links: old URL-in-URL bug, mixed protocols !! input And again with mixed protocols: [ftp://example.com?url=http://example.com link] !! result -

    And again with mixed protocols: link +

    And again with mixed protocols: link

    !!end @@ -646,7 +646,7 @@ External links: URL in text !! input URL in text: [http://example.com http://example.com] !! result -

    URL in text: http://example.com +

    URL in text: http://example.com

    !! end @@ -655,7 +655,7 @@ External links: Clickable images !! input ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png] !! result -

    ja-style clickable images: Ncwikicol.png +

    ja-style clickable images: Ncwikicol.png

    !!end @@ -664,7 +664,7 @@ External links: raw ampersand !! input Old & use: http://x&y !! result -

    Old & use: http://x&y +

    Old & use: http://x&y

    !! end @@ -673,7 +673,7 @@ External links: encoded ampersand !! input Old & use: http://x&y !! result -

    Old & use: http://x&y +

    Old & use: http://x&y

    !! end @@ -682,7 +682,7 @@ External links: encoded equals (bug 6102) !! input http://example.com/?foo=bar !! result -

    http://example.com/?foo=bar +

    http://example.com/?foo=bar

    !! end @@ -691,7 +691,7 @@ External links: [raw ampersand] !! input Old & use: [http://x&y] !! result -

    Old & use: [1] +

    Old & use: [1]

    !! end @@ -700,7 +700,7 @@ External links: [encoded ampersand] !! input Old & use: [http://x&y] !! result -

    Old & use: [1] +

    Old & use: [1]

    !! end @@ -709,7 +709,7 @@ External links: [encoded equals] (bug 6102) !! input [http://example.com/?foo=bar] !! result -

    [1] +

    [1]

    !! end @@ -718,7 +718,7 @@ External links: www.jpeg.org (bug 554) !! input http://www.jpeg.org !!result -

    http://www.jpeg.org +

    http://www.jpeg.org

    !! end @@ -727,7 +727,7 @@ External links: URL within URL (original bug 2) !! input [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp] !! result -

    [1] +

    [1]

    !! end @@ -736,7 +736,7 @@ BUG 361: URL inside bracketed URL !! input [http://www.example.com/foo http://www.example.com/bar] !! result -

    http://www.example.com/bar +

    http://www.example.com/bar

    !! end @@ -745,7 +745,7 @@ BUG 361: URL within URL, not bracketed !! input http://www.example.com/foo?=http://www.example.com/bar !! result -

    http://www.example.com/foo?=http://www.example.com/bar +

    http://www.example.com/foo?=http://www.example.com/bar

    !! end @@ -754,7 +754,7 @@ BUG 289: ">"-token in URL-tail !! input http://www.example.com/ !! result -

    http://www.example.com/<hello> +

    http://www.example.com/<hello>

    !!end @@ -763,7 +763,7 @@ BUG 289: literal ">"-token in URL-tail !! input http://www.example.com/html !! result -

    http://www.example.com/html +

    http://www.example.com/html

    !!end @@ -772,7 +772,7 @@ BUG 289: ">"-token in bracketed URL !! input [http://www.example.com/ stuff] !! result -

    <hello> stuff +

    <hello> stuff

    !!end @@ -781,7 +781,7 @@ BUG 289: literal ">"-token in bracketed URL !! input [http://www.example.com/html stuff] !! result -

    html stuff +

    html stuff

    !!end @@ -790,7 +790,7 @@ BUG 289: literal double quote at end of URL !! input http://www.example.com/"hello" !! result -

    http://www.example.com/"hello" +

    http://www.example.com/"hello"

    !!end @@ -799,7 +799,7 @@ BUG 289: literal double quote in bracketed URL !! input [http://www.example.com/"hello" stuff] !! result -

    "hello" stuff +

    "hello" stuff

    !!end @@ -811,7 +811,7 @@ disabled !! input [http://www.example.com test] !! result -

    [http://www.example.com test] +

    [http://www.example.com test]

    !! end @@ -820,7 +820,7 @@ External links: multiple legal whitespace is fine, Magnus. Don't break it please !! input [http://www.example.com test] !! result -

    test +

    test

    !! end @@ -829,7 +829,7 @@ External links: wiki links within external link (Bug 3695) !! input [http://example.com [[wikilink]] embedded in ext link] !! result -

    wikilink embedded in ext link +

    wikilink embedded in ext link

    !! end @@ -854,11 +854,11 @@ Bug 2702: Mismatched , and tags are invalid ''Something [http://example.com mixed''''', even bold]''' '''''Now [http://example.com both'''''] !! result -

    text -text -Something in italic -Something mixed, even bold -Now both +

    text +text +Something in italic +Something mixed, even bold +Now both

    !! end @@ -868,7 +868,7 @@ Bug 4781: %26 in URL !! input http://www.example.com/?title=AT%26T !! result -

    http://www.example.com/?title=AT%26T +

    http://www.example.com/?title=AT%26T

    !! end @@ -877,7 +877,7 @@ Bug 4781, 5267: %26 in URL !! input http://www.example.com/?title=100%25_Bran !! result -

    http://www.example.com/?title=100%25_Bran +

    http://www.example.com/?title=100%25_Bran

    !! end @@ -886,7 +886,7 @@ Bug 4781, 5267: %28, %29 in URL !! input http://www.example.com/?title=Ben-Hur_%281959_film%29 !! result -

    http://www.example.com/?title=Ben-Hur_%281959_film%29 +

    http://www.example.com/?title=Ben-Hur_%281959_film%29

    !! end @@ -896,7 +896,7 @@ Bug 4781: %26 in autonumber URL !! input [http://www.example.com/?title=AT%26T] !! result -

    [1] +

    [1]

    !! end @@ -905,7 +905,7 @@ Bug 4781, 5267: %26 in autonumber URL !! input [http://www.example.com/?title=100%25_Bran] !! result -

    [1] +

    [1]

    !! end @@ -914,7 +914,7 @@ Bug 4781, 5267: %28, %29 in autonumber URL !! input [http://www.example.com/?title=Ben-Hur_%281959_film%29] !! result -

    [1] +

    [1]

    !! end @@ -924,7 +924,7 @@ Bug 4781: %26 in bracketed URL !! input [http://www.example.com/?title=AT%26T link] !! result -

    link +

    link

    !! end @@ -933,7 +933,7 @@ Bug 4781, 5267: %26 in bracketed URL !! input [http://www.example.com/?title=100%25_Bran link] !! result -

    link +

    link

    !! end @@ -942,7 +942,7 @@ Bug 4781, 5267: %28, %29 in bracketed URL !! input [http://www.example.com/?title=Ben-Hur_%281959_film%29 link] !! result -

    link +

    link

    !! end @@ -951,7 +951,7 @@ External link containing double-single-quotes in text '' (bug 4598 sanity check) !! input Some [http://example.com/ pretty ''italics'' and stuff]! !! result -

    Some pretty italics and stuff! +

    Some pretty italics and stuff!

    !! end @@ -960,7 +960,7 @@ External link containing double-single-quotes in text embedded in italics (bug 4 !! input ''Some [http://example.com/ pretty ''italics'' and stuff]!'' !! result -

    Some pretty italics and stuff! +

    Some pretty italics and stuff!

    !! end @@ -1199,7 +1199,7 @@ Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2 !! result -
    [1]" onmouseover="alert(document.cookie)">test +[1]" onmouseover="alert(document.cookie)">test
    @@ -1396,7 +1396,7 @@ Plain link to URL !! input [[http://www.example.org]] !! result -

    [[1]] +

    [[1]]

    !! end @@ -1416,7 +1416,7 @@ Piped link to URL !! input Piped link to URL: [[http://www.example.org|an example URL]] !! result -

    Piped link to URL: [example URL] +

    Piped link to URL: [example URL]

    !! end @@ -1469,7 +1469,7 @@ Inline interwiki link !! input [[MeatBall:SoftSecurity]] !! result -

    MeatBall:SoftSecurity +

    MeatBall:SoftSecurity

    !! end @@ -1478,7 +1478,7 @@ Inline interwiki link with empty title (bug 2372) !! input [[MeatBall:]] !! result -

    MeatBall: +

    MeatBall:

    !! end @@ -1488,8 +1488,8 @@ Interwiki link encoding conversion (bug 1636) *[[Wikipedia:ro:Olteniţa]] *[[Wikipedia:ro:Olteniţa]] !! result -