789 |
sub new ($) { |
sub new ($) { |
790 |
my $class = shift; |
my $class = shift; |
791 |
my $self = bless { |
my $self = bless { |
792 |
level => {must => 'm', |
level => { |
793 |
should => 's', |
must => 'm', |
794 |
warn => 'w', |
should => 's', |
795 |
info => 'i', |
obc => 's', ## Obsolete but conforming, # XXX distinguish from "should" |
796 |
uncertain => 'u'}, |
warn => 'w', |
797 |
|
info => 'i', |
798 |
|
uncertain => 'u', |
799 |
|
}, |
800 |
}, $class; |
}, $class; |
801 |
$self->{set_nc} = sub { |
$self->{set_nc} = sub { |
802 |
$self->{nc} = -1; |
$self->{nc} = -1; |
930 |
my $doctype = $self->{document}->create_document_type_definition |
my $doctype = $self->{document}->create_document_type_definition |
931 |
($doctype_name); |
($doctype_name); |
932 |
|
|
933 |
$doctype_name =~ tr/A-Z/a-z/; # ASCII case-insensitive |
$doctype_name =~ tr/A-Z/a-z/; # ASCII case-insensitive. |
934 |
if ($doctype_name ne 'html') { |
if ($doctype_name ne 'html') { |
935 |
!!!cp ('t1'); |
!!!cp ('t1'); |
936 |
!!!parse-error (type => 'not HTML5', token => $token); |
!!!parse-error (type => 'not HTML5', token => $token); |
937 |
} elsif (defined $token->{pubid}) { |
} elsif (defined $token->{pubid}) { |
938 |
!!!cp ('t2'); |
## Obsolete permitted DOCTYPEs (case-sensitive) |
939 |
## XXX Obsolete permitted DOCTYPEs |
my $xsysid = { |
940 |
!!!parse-error (type => 'not HTML5', token => $token); |
'-//W3C//DTD HTML 4.0//EN' => 'http://www.w3.org/TR/REC-html40/strict.dtd', |
941 |
|
'-//W3C//DTD HTML 4.01//EN' => 'http://www.w3.org/TR/html4/strict.dtd', |
942 |
|
'-//W3C//DTD XHTML 1.0 Strict//EN' => 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd', |
943 |
|
'-//W3C//DTD XHTML 1.1//EN' => 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd', |
944 |
|
}->{$token->{pubid}}; |
945 |
|
if (defined $xsysid and |
946 |
|
(not defined $token->{sysid} or $token->{sysid} eq $xsysid)) { |
947 |
|
!!!cp ('t2'); |
948 |
|
!!!parse-error (type => 'obs DOCTYPE', token => $token, |
949 |
|
level => $self->{level}->{obc}); ## XXX error type |
950 |
|
} else { |
951 |
|
!!!cp ('t2.1'); |
952 |
|
!!!parse-error (type => 'not HTML5', token => $token); |
953 |
|
} |
954 |
} elsif (defined $token->{sysid}) { |
} elsif (defined $token->{sysid}) { |
955 |
if ($token->{sysid} eq 'about:legacy-compat') { |
if ($token->{sysid} eq 'about:legacy-compat') { |
956 |
!!!cp ('t1.2'); ## <!DOCTYPE HTML SYSTEM "about:legacy-compat"> |
!!!cp ('t1.2'); ## <!DOCTYPE HTML SYSTEM "about:legacy-compat"> |
980 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
981 |
} elsif (defined $token->{pubid}) { |
} elsif (defined $token->{pubid}) { |
982 |
my $pubid = $token->{pubid}; |
my $pubid = $token->{pubid}; |
983 |
$pubid =~ tr/a-z/A-z/; |
$pubid =~ tr/a-z/A-Z/; ## ASCII case-insensitive. |
984 |
my $prefix = [ |
my $prefix = [ |
985 |
"+//SILMARIL//DTD HTML PRO V0R11 19970101//", |
"+//SILMARIL//DTD HTML PRO V0R11 19970101//", |
986 |
"-//ADVASOFT LTD//DTD HTML 3.0 ASWEDIT + EXTENSIONS//", |
"-//ADVASOFT LTD//DTD HTML 3.0 ASWEDIT + EXTENSIONS//", |
1072 |
} |
} |
1073 |
if (defined $token->{sysid}) { |
if (defined $token->{sysid}) { |
1074 |
my $sysid = $token->{sysid}; |
my $sysid = $token->{sysid}; |
1075 |
$sysid =~ tr/A-Z/a-z/; |
$sysid =~ tr/A-Z/a-z/; ## ASCII case-insensitive. |
1076 |
if ($sysid eq "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") { |
if ($sysid eq "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") { |
1077 |
## NOTE: Ensure that |PUBLIC "(limited quirks)" "(quirks)"| is |
## NOTE: Ensure that |PUBLIC "(limited quirks)" "(quirks)"| |
1078 |
## marked as quirks. |
## is signaled as in quirks mode! |
1079 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
1080 |
!!!cp ('t11'); |
!!!cp ('t11'); |
1081 |
} else { |
} else { |