validator/httpd/cgi-bin check,1.490,1.491

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv30183

Modified Files:
	check 
Log Message:
 working around an apparent odd limitation of libxml
 which only gives context for lines up to 80 chars
 http://www.w3.org/Bugs/Public/show_bug.cgi?id=4420
 http://bugzilla.gnome.org/show_bug.cgi?id=424017


Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.490
retrieving revision 1.491
diff -u -d -r1.490 -r1.491
--- check	29 Mar 2007 04:46:55 -0000	1.490
+++ check	29 Mar 2007 06:07:39 -0000	1.491
@@ -646,6 +646,14 @@
           if ($msg_line =~ /(.+)\^/){
             $xmlwf_error_col = length($1);
           }
+          if ($xmlwf_error_col == 79){
+            # working around an apparent odd limitation of libxml
+            # which only gives context for lines up to 80 chars
+            # http://www.w3.org/Bugs/Public/show_bug.cgi?id=4420
+            # http://bugzilla.gnome.org/show_bug.cgi?id=424017
+            $xmlwf_error_col = "> 80";
+            # non-int line number will trigger the proper behavior in report_error
+          }
           
           if ((defined $xmlwf_error_line) and (defined $xmlwf_error_col) and (defined $xmlwf_error_msg)){
             $err->{src}  = '...'; # do this with show_open_entities()?
@@ -1460,10 +1468,19 @@
 
   if (scalar @{$File->{Errors}}) {
     foreach my $err (@{$File->{Errors}}) {
-      my ($line, $col) = &truncate_line($File->{Content}->[$err->{line}-1], $err->{char});
-
-      $line = &mark_error($line, $col);
-
+      my $line;
+      my $col;
+      if ($err->{char} =~ /^[0-9]+$/ ){
+        ($line, $col) = &truncate_line($File->{Content}->[$err->{line}-1], $err->{char});
+        $line = &mark_error($line, $col);
+      }
+      else {
+        $col = int($File->{Content}->[$err->{line}-1]);
+        $col = 150 if ($col > 150);
+        ($line, $col) = &truncate_line($File->{Content}->[$err->{line}-1], $col);
+        $line = &ent($line);
+        $col = "";
+      }
       my $explanation;
       if ($err->{num}) {
         my $num = $err->{num};        

Received on Thursday, 29 March 2007 06:07:54 UTC