validator/httpd/cgi-bin check,1.637,1.638

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

Modified Files:
	check 
Log Message:
Support HTML5 "DOCTYPE legacy string", detect HTML5 to HTML5 doctype (non-)override.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.637
retrieving revision 1.638
diff -u -d -r1.637 -r1.638
--- check	7 Jan 2009 22:19:30 -0000	1.637
+++ check	18 Jan 2009 17:26:04 -0000	1.638
@@ -1779,7 +1779,13 @@
     $seen_doctype = TRUE;
 
     $org_dtd = &ent($text);
-    ($File->{Root}, $File->{DOCTYPE}) = $text =~ m(<!DOCTYPE\s+(\w[\w\.-]+)\s+(?:PUBLIC|SYSTEM)\s+(?:[\'\"])([^\"\']+)(?:[\"\']).*>)si;
+    ($File->{Root}, undef, $File->{DOCTYPE}) = $text =~
+      /<!DOCTYPE\s+(\w[\w\.-]+)(?:\s+(?:PUBLIC|SYSTEM)\s+(['"])(.*?)\2)?\s*>/si;
+
+    $File->{DOCTYPE} = 'HTML5'
+      if (lc($File->{Root} || '') eq 'html' &&
+          (!defined($File->{DOCTYPE}) || $File->{DOCTYPE} eq 'XSLT-compat'));
+
     # No Override if Fallback was requested, or if override is the same as detected
     my $known = $CFG->{Types}->{$File->{DOCTYPE}};
     if ($File->{Opt}->{FB}->{DOCTYPE} or
@@ -2098,7 +2104,7 @@
     my $declaration = shift;
     my $doctype_type;
     my $doctype_secondpart;
-    if ($declaration =~ m(<!DOCTYPE\s+HTML\s*>)si) {
+    if ($declaration =~ /<!DOCTYPE\s+html(?:\s+PUBLIC\s+(['"])XSLT-compat\1)?\s*>/si) {
       $File->{Root} = "html";
       $File->{DOCTYPE} = "HTML5";
     }

Received on Sunday, 18 January 2009 17:26:14 UTC