- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 17 Feb 2009 14:10:43 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin In directory hutz:/tmp/cvs-serv27718/httpd/cgi-bin Modified Files: check Log Message: fixing bug in fuzzy matching routine that would match with list of attributes even when an unknown element would be found Index: check =================================================================== RCS file: /sources/public/validator/httpd/cgi-bin/check,v retrieving revision 1.648 retrieving revision 1.649 diff -u -d -r1.648 -r1.649 --- check 16 Feb 2009 14:11:42 -0000 1.648 +++ check 17 Feb 2009 14:10:41 -0000 1.649 @@ -3015,11 +3015,20 @@ } else { my @matches; - @matches = String::Approx::amatch($bogus_elt_attr, ["3i"], keys %{$self->{CFG}->{Attributes}}); + if ($err->{num} eq '108') { + @matches = String::Approx::amatch($bogus_elt_attr, ["3i"], keys %{$self->{CFG}->{Attributes}}); + } + elsif ($err->{num} eq '76') { + @matches = String::Approx::amatch($bogus_elt_attr, ["3i"], keys %{$self->{CFG}->{Elements}}); + } if (@matches){ my %distances; - @distances{@matches} = map { abs } String::Approx::adistr(lc($bogus_elt_attr), @matches); + @distances{@matches} = map { abs } String::Approx::adist(lc($bogus_elt_attr), @matches); my @matches_sorted = sort { $distances{$a} <=> $distances{$b} } @matches; + # a bit of printf debugging can't hurt + # foreach my $match (@matches_sorted) { + # $err->{msg} .= '<br /> match '.$match.': '.$distances{$match}; + # } if (@matches > 1){ $err->{msg} .= '. Maybe you meant "'.$matches_sorted[0].'" or "'.$matches_sorted[1].'"?';
Received on Tuesday, 17 February 2009 14:10:51 UTC