W3C home > Mailing lists > Public > www-validator-cvs@w3.org > May 2004

validator/httpd/cgi-bin check,1.305.2.113,1.305.2.114

From: Ville Skytta <ville@hutz.w3.org>
Date: Sat, 15 May 2004 07:04:52 +0000
To: www-validator-cvs@w3.org
Message-Id: <20040515070452.891C34B83@hutz.w3.org>

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

Modified Files:
      Tag: validator-0_6_0-branch
	check 
Log Message:
Avoid linking to unknown elements from the parse tree markup.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.305.2.113
retrieving revision 1.305.2.114
diff -u -d -r1.305.2.113 -r1.305.2.114
--- check	15 May 2004 06:58:10 -0000	1.305.2.113
+++ check	15 May 2004 07:04:49 -0000	1.305.2.114
@@ -2288,14 +2288,18 @@
 
     my $printme;
     chomp($printme = $line);
-    $printme =~ s{^([()])(.*)} # reformat and add links on HTML elements
-                 { my $close = '';
-                      $close = "/" if $1 eq ")"; # ")" -> close-tag
-                   "&lt;" . $close . "<a href=\"" .
-                   $CFG->{'Element Ref URI'} . $CFG->{'Element Map'}->{lc($2)} .
-                   "\">$2<\/a>&gt;"
-                 }egx;
-    $printme =~ s,^A,  A,; # indent attributes a bit
+
+    if (my ($close, $elem) = $printme =~ /^([()])(.+)/) {
+      # reformat and add links on HTML elements
+      $close = ($close eq ')') ? '/' : ''; # ")" -> close-tag
+      if (my $u = $CFG->{'Element Map'}->{lc($elem)}) {
+        $elem = '<a href="' . $CFG->{'Element Ref URI'} . "$u\">$elem</a>";
+      }
+      $printme = "&lt;$close$elem&gt;";
+    } else {
+      $printme =~ s,^A,  A,; # indent attributes a bit
+    }
+
     print ' ' x $indent, $printme, "\n";
     if ($line =~ /^\(/) {
       $indent += 2;
Received on Saturday, 15 May 2004 03:06:47 UTC

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