- From: Ville Skytta via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 27 Apr 2007 20:17:50 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin In directory hutz:/tmp/cvs-serv8529/httpd/cgi-bin Modified Files: check Log Message: Cleanups, NFC. Index: check =================================================================== RCS file: /sources/public/validator/httpd/cgi-bin/check,v retrieving revision 1.503 retrieving revision 1.504 diff -u -d -r1.503 -r1.504 --- check 24 Apr 2007 06:48:04 -0000 1.503 +++ check 27 Apr 2007 20:17:48 -0000 1.504 @@ -172,7 +172,7 @@ # # Set debug flag. - if ($CFG->{'Allow Debug'} == TRUE) { + if ($CFG->{'Allow Debug'}) { $DEBUG = TRUE if $ENV{W3C_VALIDATOR_DEBUG} || $CFG->{'Enable Debug'}; } else { $DEBUG = FALSE; @@ -1328,8 +1328,6 @@ # let's force the view source so that the user knows what we've put around their code $File->{Opt}->{'Show Source'} = TRUE; } - - return $File; } @@ -1556,7 +1554,7 @@ my $escaped_uri = uri_escape($File->{URI}); $_msg =~ s/<!--URI-->/$escaped_uri/g; } - $explanation = " $_msg\n".$explanation; # The send feedback plea. + $explanation = " $_msg\n$explanation"; # The send feedback plea. } $err->{src} = $line; @@ -2221,8 +2219,7 @@ if ($self->{am_in_heading} == 1) { my $data = $chars->{Data}; $data =~ s/[\r|\n]/ /g; - $self->{_file}->{heading_outline} = - $self->{_file}->{heading_outline} . $data; + $self->{_file}->{heading_outline} .= $data; } } @@ -2232,8 +2229,7 @@ if ($self->{am_in_heading} == 1) { my $data = $chars->{Data}; $data =~ s/[\r|\n]/ /g; - $self->{_file}->{heading_outline} = - $self->{_file}->{heading_outline} . $data; + $self->{_file}->{heading_outline} .= $data; } } @@ -2243,13 +2239,14 @@ my ($self, $element) = @_; if ($element->{Name} =~ /^h([1-6])$/i) { - $self->{_file}->{heading_outline} = $self->{_file}->{heading_outline} . " " x int($1) . "[". $element->{Name}."] "; + $self->{_file}->{heading_outline} .= + " " x int($1) . "[$element->{Name}] "; $self->{am_in_heading} = 1; } my $has_xmlns = FALSE; my $xmlns_value = undef; - + if ( ($self->{_file}->{Mode} eq 'XML')){ # if in XML mode, find namespace used for each element foreach my $attr (keys %{$element->{Attributes}}) { @@ -2275,10 +2272,12 @@ } } } - - if (($element->{Name} eq $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Name}) - and ($has_xmlns == FALSE) - and ($CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{"Namespace Required"} eq TRUE )){ + + my $doctype = $self->{_file}->{DOCTYPE}; + + if (($element->{Name} eq $CFG->{Types}->{$doctype}->{Name}) + and !$has_xmlns + and ($CFG->{Types}->{$doctype}->{"Namespace Required"} eq TRUE)) { # whine if the root xmlns attribute is noted as required by spec, but not present my $err; my $location = $self->{_parser}->get_location(); @@ -2293,9 +2292,9 @@ $self->{_file}->{'Is Valid'} = FALSE; push @{$self->{_file}->{Errors}}, $err; } - elsif (($element->{Name} eq $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Name}) - and ($has_xmlns == TRUE) and (defined $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace}) - and ($xmlns_value ne $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace}) ) { + elsif (($element->{Name} eq $CFG->{Types}->{$doctype}->{Name}) + and $has_xmlns and (defined $CFG->{Types}->{$doctype}->{Namespace}) + and ($xmlns_value ne $CFG->{Types}->{$doctype}->{Namespace}) ) { # whine if root xmlns element is not the one specificed by the spec my $err; my $location = $self->{_parser}->get_location(); @@ -2304,18 +2303,19 @@ $err->{char} = $location->{ColumnNumber}; $err->{num} = "wrong-xmlns"; $err->{type} = "E"; - $err->{msg} = "Wrong xmlns attribute for element ".$element->{Name}.". The value should be: ". $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Namespace}; + $err->{msg} = "Wrong xmlns attribute for element $element->{Name}. " . + "The value should be: $CFG->{Types}->{$doctype}->{Namespace}"; # ... $self->{_file}->{'Is Valid'} = FALSE; push @{$self->{_file}->{Errors}}, $err; } - elsif (($element->{Name} ne $CFG->{Types}->{$self->{_file}->{DOCTYPE}}->{Name}) - and ($has_xmlns == TRUE)) { + elsif (($element->{Name} ne $CFG->{Types}->{$doctype}->{Name}) + and $has_xmlns) { # add to list of non-root namespace push(@{$self->{_file}->{Namespaces}}, $xmlns_value); } - + } @@ -2323,7 +2323,7 @@ { my ($self, $element) = @_; if ($element->{Name} =~ /^h[1-6]$/i) { - $self->{_file}->{heading_outline} = $self->{_file}->{heading_outline} . "\n"; + $self->{_file}->{heading_outline} .= "\n"; $self->{am_in_heading} = 0; }
Received on Friday, 27 April 2007 20:17:55 UTC