W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2008

validator/httpd/cgi-bin check,1.603,1.604

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 09 Sep 2008 12:55:35 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Kd2kp-0005ai-3J@lionel-hutz.w3.org>

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

Modified Files:
	check 
Log Message:
Tag stripping and escaping of error messages and context. I was initially hoping to keep
formatting in the error messages from the parsers, when available, but the discrepancies
and differences in escaping (or lack thereof) calls for a more drastic approach. Thus:
* better escaping of opensp messages (including instances of rogue amps)
* tag stripping of formatting in html5 parser messages
* no named entities in source snippet
* template output is escaped



Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.603
retrieving revision 1.604
diff -u -d -r1.603 -r1.604
--- check	26 Aug 2008 16:09:17 -0000	1.603
+++ check	9 Sep 2008 12:55:33 -0000	1.604
@@ -903,8 +903,8 @@
       my @child_nodes =  $message_node->childNodes;  
       foreach my $child_node (@child_nodes) {
         if ($child_node->localname eq "message") {
-          $html5_error_msg = $child_node->toString();
-          $html5_error_msg =~ s,</?message>,,gi;
+          $html5_error_msg= $child_node->toString();
+          $html5_error_msg =~ s,</?[^>]*>,,gsi;
         }
         if ($child_node->localname eq "elaboration") {
           $html5_error_expl = $child_node->toString();
@@ -1870,7 +1870,7 @@
         $col = length($File->{Content}->[$err->{line}-1]);
         $col = 80 if ($col > 80);
         ($line, $col) = &truncate_line($File->{Content}->[$err->{line}-1], $col);
-        $line = &ent($line) . "&hellip;";
+        $line = &ent($line) . "…";
         $col = 0;
       }
       my $explanation = "";
@@ -2894,6 +2894,8 @@
   $err->{type} = $mess->{primary_message}{Severity};
   $err->{msg}  = $mess->{primary_message}{Text};
 
+  $err->{msg}  =~ s/"&"/"&amp;"/gsi;
+
   # our parser OpenSP is not quite XML-aware, or XML Namespaces Aware, 
   # so we filter out a few errors for now
 
Received on Tuesday, 9 September 2008 12:56:15 UTC

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