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

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