- From: Mercurial notifier <nobody@w3.org>
- Date: Mon, 12 Dec 2011 19:31:39 +0000
- To: markup-validator updates <www-validator-cvs@w3.org>
changeset: 3272:772799001c73 tag: tip user: Ville Skyttä <ville.skytta@iki.fi> date: Mon Dec 12 21:30:42 2011 +0200 files: httpd/cgi-bin/check description: Don't change line numbers when overriding multiline charset indication. diff -r 70a40c2248c3 -r 772799001c73 httpd/cgi-bin/check --- a/httpd/cgi-bin/check Tue Nov 29 22:36:52 2011 +0200 +++ b/httpd/cgi-bin/check Mon Dec 12 21:30:42 2011 +0200 @@ -2301,13 +2301,22 @@ my $content = join("\n", @{$File->{Content}}); + # Flatten newlines (so that we don't end up changing line numbers while + # overriding) and comment-escape a string. + sub escape_original ($) + { + my $str = shift; + $str =~ tr/\r\n/ /; + return &escape_comment($str); + } + # <?xml encoding="charset"?> $content =~ s/( (^<\?xml\b[^>]*?${ws}encoding${ws}*=${ws}*(["'])) (${cs}) (\3.*?\?>) )/lc($4) eq lc($charset) ? - "$1" : "$2$charset$5<!-- " . &escape_comment($1) ." -->"/esx; + "$1" : "$2$charset$5<!-- " . &escape_original($1) . " -->"/esx; # <meta charset="charset"> $content =~ s/( @@ -2315,7 +2324,7 @@ (${cs}) (.*?>) )/lc($3) eq lc($charset) ? - "$1" : "$2$charset$4<!-- " . &escape_comment($1) . " -->"/esix; + "$1" : "$2$charset$4<!-- " . &escape_original($1) . " -->"/esix; # <meta http-equiv="content-type" content="some/type; charset=charset"> $content =~ s/( @@ -2325,7 +2334,7 @@ (${cs}) (.*?>) )/lc($3) eq lc($charset) ? - "$1" : "$2$charset$4<!-- " . &escape_comment($1) . " -->"/esix; + "$1" : "$2$charset$4<!-- " . &escape_original($1) . " -->"/esix; # <meta content="some/type; charset=charset" http-equiv="content-type"> $content =~ s/( @@ -2334,7 +2343,7 @@ (${cs}) ([^>]*?${ws}http-equiv${ws}*=${ws}*["']?${ws}*content-type\b.*?>) )/lc($3) eq lc($charset) ? - "$1" : "$2$charset$4<!-- " . &escape_comment($1) . " -->"/esix; + "$1" : "$2$charset$4<!-- " . &escape_original($1) . " -->"/esix; $File->{Content} = [split /\n/, $content]; }
Received on Monday, 12 December 2011 19:31:44 UTC