W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2009

validator/httpd/cgi-bin check,1.649,1.650

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 02 Mar 2009 18:32:38 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LeCwQ-0007cP-Hy@lionel-hutz.w3.org>
Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv29233/httpd/cgi-bin

Modified Files:
	check 
Log Message:
* improved wording for fuzzy-matched elements and attributes
* adding handling of case for "attribute not allowed for a particular element/context"



Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.649
retrieving revision 1.650
diff -u -d -r1.649 -r1.650
--- check	17 Feb 2009 14:10:41 -0000	1.649
+++ check	2 Mar 2009 18:32:36 -0000	1.650
@@ -3005,13 +3005,19 @@
       my $bogus_elt_attr = $err->{msg};
       $bogus_elt_attr =~ s/.*"(.+)".*/$1/;
       
-      if (
-          ((exists $self->{CFG}->{Attributes}->{lc($bogus_elt_attr)}) and ($err->{num} eq '108'))
-          or
-           ((exists $self->{CFG}->{Elements}->{lc($bogus_elt_attr)}) and ($err->{num} eq '76'))
+      if ( (
+             ((exists $self->{CFG}->{Attributes}->{lc($bogus_elt_attr)}) and ($err->{num} eq '108'))
+           or
+             ((exists $self->{CFG}->{Elements}->{lc($bogus_elt_attr)}) and ($err->{num} eq '76'))
           )
+          and (lc($bogus_elt_attr) ne $bogus_elt_attr)
+        ) 
       { 
-          $err->{msg} .= '. Maybe you meant "'.lc($bogus_elt_attr).'"?';
+          $err->{msg} .= '. Did you mean "'.lc($bogus_elt_attr).'"?';
+      }
+      elsif((lc($bogus_elt_attr) eq $bogus_elt_attr) and ($err->{num} eq '108')) {
+          # attribute not available in this context.
+          $err->{msg} = 'Attribute '.$bogus_elt_attr.' exists, but can not be used for this element.';
       }
       else {
           my @matches;
@@ -3030,11 +3036,11 @@
               #     $err->{msg} .= '<br /> match '.$match.': '.$distances{$match};
               # }
                if (@matches > 1){
-                  $err->{msg} .= '. Maybe you meant "'.$matches_sorted[0].'" or "'.$matches_sorted[1].'"?';
+                  $err->{msg} .= '. Did you mean "'.$matches_sorted[0].'" or "'.$matches_sorted[1].'"?';
               
               }
               else {
-                  $err->{msg} .= '. Maybe you meant "'.$matches_sorted[0].'"?';
+                  $err->{msg} .= '. Did you mean "'.$matches_sorted[0].'"?';
               }
           }
       }
Received on Monday, 2 March 2009 18:32:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:02:34 UTC