validator/httpd/cgi-bin check,1.354,1.355

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

Modified Files:
	check 
Log Message:
Make doctype override work again (#941).  Somewhat ugly, yes.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.354
retrieving revision 1.355
diff -u -d -r1.354 -r1.355
--- check	12 Nov 2004 18:04:40 -0000	1.354
+++ check	13 Nov 2004 10:31:18 -0000	1.355
@@ -1472,11 +1472,16 @@
 # Suppress any existing DOCTYPE by commenting it out.
 sub override_doctype {
   no strict 'vars';
-  my $File    = shift;
-  my $pubid = $CFG->{Types}->{$File->{Opt}->{DOCTYPE}}->{PubID};
-  my $sysid = $CFG->{Types}->{$File->{Opt}->{DOCTYPE}}->{SysID};
-  my $name  = $CFG->{Types}->{$File->{Opt}->{DOCTYPE}}->{Name};
-  local $dtd  = qq(<!DOCTYPE $name PUBLIC "$pubid"\n  "$sysid">);
+  my $File  = shift;
+  my ($dt)  =
+    grep { $_->{Display} eq $File->{Opt}->{DOCTYPE} } values %{$CFG->{Types}};
+  # @@@ TODO: abort/whine about unrecognized doctype if $dt is undef.
+  my $pubid = $dt->{PubID};
+  my $sysid = $dt->{SysID};
+  my $name  = $dt->{Name};
+  local $dtd = qq(<!DOCTYPE $name PUBLIC "$pubid");
+  $dtd .= qq(\n  "$sysid") if $sysid; # We don't have one for all types.
+  $dtd .= '>';
   local $org_dtd = '';
   local $HTML = '';
   local $seen = FALSE;

Received on Saturday, 13 November 2004 10:31:20 UTC