- From: Olivier Thereaux <ot@dev.w3.org>
- Date: Mon, 15 Nov 2004 05:27:13 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin In directory hutz:/tmp/cvs-serv21300/httpd/cgi-bin Modified Files: check Log Message: re-adding error message explanations - still misses Jim's bit of JS to load them only once. http://www.w3.org/Bugs/Public/show_bug.cgi?id=906 Index: check =================================================================== RCS file: /sources/public/validator/httpd/cgi-bin/check,v retrieving revision 1.359 retrieving revision 1.360 diff -u -d -r1.359 -r1.360 --- check 13 Nov 2004 21:40:11 -0000 1.359 +++ check 15 Nov 2004 05:27:11 -0000 1.360 @@ -1651,6 +1651,9 @@ sub report_errors ($) { my $File = shift; my $Errors = []; + + # Hash to keep track of how many of each error is reported. + my %Msgs; # Used to generate a UID for explanations. if (scalar @{$File->{Errors}}) { foreach my $err (@{$File->{Errors}}) { @@ -1671,8 +1674,30 @@ } #DEBUG; + my $explanation; + + if ($err->{num}) { + my(undef, $num) = split /\./, $err->{num}; + if (exists $Msgs{$num}) { # We've already seen this message... + if ($File->{Opt}->{Verbose}) { # ...so only repeat it in Verbose mode. + $explanation = qq(\n <div class="hidden mid-$num"></div>\n); + } + } else { + $Msgs{$num} = 1; + $explanation .= "\n $RSRC->{msg}->{$num}->{verbose}\n" + if exists $RSRC->{msg}->{$num} + && exists $RSRC->{msg}->{$num}->{verbose}; + } + my $_msg = $RSRC->{msg}->{nomsg}->{verbose}; + $_msg =~ s/<!--MID-->/$num/g; + $explanation .= " $_msg\n"; # The send feedback plea. + } + + + $err->{src} = $line; $err->{col} = ' ' x $col; + $err->{expl} = $explanation; push @{$Errors}, $err; } @@ -1749,6 +1774,9 @@ $char = qq(<strong title="Position where error was detected.">$char</strong>); $line = $left . $char . $right; + + + return $line; }
Received on Monday, 15 November 2004 05:27:13 UTC