- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 06 Sep 2007 06:20:38 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/perl/modules/W3C/LogValidator/lib/W3C/LogValidator In directory hutz:/tmp/cvs-serv7219/lib/W3C/LogValidator Modified Files: CSSValidator.pm Log Message: porting the ShowInvalid, ShowAborted and ShowValid options to CSS Validator module Index: CSSValidator.pm =================================================================== RCS file: /sources/public/perl/modules/W3C/LogValidator/lib/W3C/LogValidator/CSSValidator.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- CSSValidator.pm 4 Sep 2007 06:23:56 -0000 1.18 +++ CSSValidator.pm 6 Sep 2007 06:20:36 -0000 1.19 @@ -45,11 +45,15 @@ { $self->{AUTH_EXT} = ".css"; } - $config{ValidatorHost} = "jigsaw.w3.org" if (! exists $config{ValidatorHost}); - $config{ValidatorPort} = "80" if (!exists $config{ValidatorPort}); - $config{ValidatorString} = "/css-validator/validator" if (!exists $config{ValidatorString}); - bless($self, $class); - return $self; + $config{ValidatorHost} = "jigsaw.w3.org" if (! exists $config{ValidatorHost}); + $config{ValidatorPort} = "80" if (!exists $config{ValidatorPort}); + $config{ValidatorString} = "/css-validator/validator" if (!exists $config{ValidatorString}); + # by default, report invalid documents + $config{ShowInvalid} = "Yes" if (!exists $config{ShowInvalid}); + $config{ShowAborted} = "No" if (!exists $config{ShowAborted}); + $config{ShowValid} = "No" if (!exists $config{ShowValid}); + bless($self, $class); + return $self; } @@ -211,7 +215,24 @@ push @result_head, "#Error(s)"; push @result_head, "Address"; - my $intro="Here are the <census> most popular invalid document(s) that I could find in the + my @whatweshow; + my $whatweshow_str = ""; + + push @whatweshow, "valid" if ($config{ShowValid} eq "Yes"); + push @whatweshow, "invalid" if ($config{ShowInvalid} eq "Yes"); + push @whatweshow, "non-validable" if ($config{ShowAborted} eq "Yes"); + if (@whatweshow eq 3) { + $whatweshow_str = "$whatweshow[0], $whatweshow[1] or $whatweshow[2]"; + } + elsif (@whatweshow eq 2) { + $whatweshow_str = "$whatweshow[0] or $whatweshow[1]"; + } + elsif (@whatweshow eq 1) { + $whatweshow_str = "$whatweshow[0]"; + } + + + my $intro="Here are the <census> most popular $whatweshow_str document(s) that I could find in the logs for $name."; my $outro; @@ -251,16 +272,22 @@ else # success - not valid -> invalid { printf ("Invalid, %s error(s)!",$self->valid_err_num) if ($verbose > 1);; - my @result_tmp; - push @result_tmp, $total_census; - push @result_tmp, $hits{$uri_orig}; - push @result_tmp, $self->valid_err_num; - push @result_tmp, $uri_orig; - push @result, [@result_tmp]; - $invalid_census++; - $last_invalid_position = $total_census; } } + if ( ((! $self->valid_success) and ($config{ShowAborted} eq "Yes")) + or (($self->valid_success) and (! $self->valid) and ($config{ShowInvalid} eq "Yes")) + or (($self->valid_success) and ($self->valid) and ($config{ShowValid} eq "Yes")) ){ + my @result_tmp; + push @result_tmp, $total_census; + push @result_tmp, $hits{$uri_orig}; + if (! $self->valid_success) { push @result_tmp, "Abort";} + else {push @result_tmp, $self->valid_err_num;} + push @result_tmp, $uri_orig; + push @result, [@result_tmp]; + $invalid_census++; + $last_invalid_position = $total_census; + } + print "\n" if ($verbose > 1); @@ -283,20 +310,16 @@ # usual case { $outro="Conclusion : -I had to check $last_invalid_position document(s) in order to find $invalid_census invalid CSS documents or documents with stylesheets. -This means that about $ratio\% of your most popular documents were invalid. - -(Note that this CSS validation module is still experimental)"; +I had to check $last_invalid_position document(s) in order to find $invalid_census $whatweshow_str CSS documents or documents with stylesheets. +This means that about $ratio\% of your most popular documents were $whatweshow_str."; } else # we didn't find as many invalid docs as requested { $outro="Conclusion : -You asked for $max_invalid invalid stylesheet document(s) but I could only find $invalid_census +You asked for $max_invalid $whatweshow_str stylesheet document(s) but I could only find $invalid_census by processing (all the) $total_census document(s) in your logs. -This means that about $ratio\% of your most popular documents were invalid. - -(Note that this CSS validation module is still experimental)"; +This means that about $ratio\% of your most popular documents were $whatweshow_str."; } } elsif (!$total_census) @@ -307,7 +330,7 @@ else # everything was actually valid! { $intro=~s/<census> //; - $outro="I couldn't find any invalid document in this log. Congratulations!"; + $outro="I couldn't find any $whatweshow_str document in this log."; } if (($total_census == $max_documents) and ($total_census)) # we stopped because of max_documents {
Received on Thursday, 6 September 2007 06:34:19 UTC