| 79 |
## as defined by [IETF RFC 3066], Tags for the Identification |
## as defined by [IETF RFC 3066], Tags for the Identification |
| 80 |
## of Languages, or its successor; in addition, the empty string |
## of Languages, or its successor; in addition, the empty string |
| 81 |
## may be specified." ("may" in lower case) |
## may be specified." ("may" in lower case) |
| 82 |
## NOTE: Is an RFC 3066-valid (but RFC 4647-invalid) language tag |
## NOTE: Is an RFC 3066-valid (but RFC 4646-invalid) language tag |
| 83 |
## allowed today? |
## allowed today? |
| 84 |
|
|
| 85 |
## TODO: test data |
## TODO: test data |
| 225 |
my ($self, $item, $element_state) = @_; |
my ($self, $item, $element_state) = @_; |
| 226 |
for my $attr (@{$item->{node}->attributes}) { |
for my $attr (@{$item->{node}->attributes}) { |
| 227 |
my $attr_ns = $attr->namespace_uri; |
my $attr_ns = $attr->namespace_uri; |
| 228 |
$attr_ns = '' unless defined $attr_ns; |
if (defined $attr_ns) { |
| 229 |
|
load_ns_module ($attr_ns); |
| 230 |
|
} else { |
| 231 |
|
$attr_ns = ''; |
| 232 |
|
} |
| 233 |
my $attr_ln = $attr->manakai_local_name; |
my $attr_ln = $attr->manakai_local_name; |
| 234 |
|
|
|
load_ns_module ($attr_ns); |
|
|
|
|
| 235 |
my $checker = $AttrChecker->{$attr_ns}->{$attr_ln} |
my $checker = $AttrChecker->{$attr_ns}->{$attr_ln} |
| 236 |
|| $AttrChecker->{$attr_ns}->{''}; |
|| $AttrChecker->{$attr_ns}->{''}; |
| 237 |
my $status = $AttrStatus->{$attr_ns}->{$attr_ln} |
my $status = $AttrStatus->{$attr_ns}->{$attr_ln} |
| 302 |
## embedded content. |
## embedded content. |
| 303 |
}; |
}; |
| 304 |
|
|
| 305 |
|
our $IsInHTMLInteractiveContent = sub { |
| 306 |
|
my ($el, $nsuri, $ln) = @_; |
| 307 |
|
|
| 308 |
|
## NOTE: This CODE returns whether an element that is conditionally |
| 309 |
|
## categorizzed as an interactive content is currently in that |
| 310 |
|
## condition or not. See $HTMLInteractiveContent list defined in |
| 311 |
|
## Whatpm::ContentChecler::HTML for the list of all (conditionally |
| 312 |
|
## or permanently) interactive content. |
| 313 |
|
|
| 314 |
|
if ($nsuri eq $HTML_NS and ($ln eq 'video' or $ln eq 'audio')) { |
| 315 |
|
return $el->has_attribute ('controls'); |
| 316 |
|
} elsif ($nsuri eq $HTML_NS and $ln eq 'menu') { |
| 317 |
|
my $value = $el->get_attribute ('type'); |
| 318 |
|
$value =~ tr/A-Z/a-z/; # ASCII case-insensitive |
| 319 |
|
return ($value eq 'toolbar'); |
| 320 |
|
} else { |
| 321 |
|
return 1; |
| 322 |
|
} |
| 323 |
|
}; # $IsInHTMLInteractiveContent |
| 324 |
|
|
| 325 |
my $HTMLTransparentElements = { |
my $HTMLTransparentElements = { |
| 326 |
$HTML_NS => {qw/ins 1 del 1 font 1 noscript 1 canvas 1/}, |
$HTML_NS => {qw/ins 1 del 1 font 1 noscript 1 canvas 1 a 1/}, |
| 327 |
## NOTE: |html:noscript| is transparent if scripting is disabled |
## NOTE: |html:noscript| is transparent if scripting is disabled |
| 328 |
## and not in |head|. |
## and not in |head|. |
| 329 |
}; |
}; |
| 383 |
should => 's', |
should => 's', |
| 384 |
warn => 'w', |
warn => 'w', |
| 385 |
good => 'w', |
good => 'w', |
| 386 |
|
undefined => 'w', |
| 387 |
info => 'i', |
info => 'i', |
| 388 |
|
|
| 389 |
uncertain => 'u', |
uncertain => 'u', |
| 395 |
xml_id_error => 'm', ## TODO: ? |
xml_id_error => 'm', ## TODO: ? |
| 396 |
nc => 'm', ## XML Namespace Constraints ## TODO: correct? |
nc => 'm', ## XML Namespace Constraints ## TODO: correct? |
| 397 |
|
|
| 398 |
|
## |Whatpm::URIChecker| |
| 399 |
uri_syntax => 'm', |
uri_syntax => 'm', |
| 400 |
uri_fact => 'm', |
uri_fact => 'm', |
| 401 |
uri_lc_must => 'm', |
uri_lc_must => 'm', |
| 402 |
uri_lc_should => 'w', |
uri_lc_should => 'w', |
| 403 |
|
|
| 404 |
|
## |Whatpm::IMTChecker| |
| 405 |
mime_must => 'm', # lowercase "must" |
mime_must => 'm', # lowercase "must" |
| 406 |
mime_fact => 'm', |
mime_fact => 'm', |
| 407 |
mime_strongly_discouraged => 'w', |
mime_strongly_discouraged => 'w', |
| 408 |
mime_discouraged => 'w', |
mime_discouraged => 'w', |
| 409 |
|
|
| 410 |
|
## |Whatpm::LangTag| |
| 411 |
langtag_fact => 'm', |
langtag_fact => 'm', |
| 412 |
|
|
| 413 |
|
## |Whatpm::RDFXML| |
| 414 |
rdf_fact => 'm', |
rdf_fact => 'm', |
| 415 |
rdf_grammer => 'm', |
rdf_grammer => 'm', |
| 416 |
rdf_lc_must => 'm', |
rdf_lc_must => 'm', |
| 417 |
|
|
| 418 |
|
## |Message::Charset::Info| and |Whatpm::Charset::DecodeHandle| |
| 419 |
|
charset_variant => 'm', |
| 420 |
|
## An error caused by use of a variant charset that is not conforming |
| 421 |
|
## to the original charset (e.g. use of 0x80 in an ISO-8859-1 document |
| 422 |
|
## which is interpreted as a Windows-1252 document instead). |
| 423 |
|
charset_fact => 'm', |
| 424 |
|
iso_shall => 'm', |
| 425 |
}; |
}; |
| 426 |
|
|
| 427 |
sub check_document ($$$;$) { |
sub check_document ($$$;$) { |
| 451 |
## ISSUE: Unexpanded entity references and HTML5 conformance |
## ISSUE: Unexpanded entity references and HTML5 conformance |
| 452 |
|
|
| 453 |
my $docel_nsuri = $docel->namespace_uri; |
my $docel_nsuri = $docel->namespace_uri; |
| 454 |
$docel_nsuri = '' unless defined $docel_nsuri; |
if (defined $docel_nsuri) { |
| 455 |
load_ns_module ($docel_nsuri); |
load_ns_module ($docel_nsuri); |
| 456 |
|
} else { |
| 457 |
|
$docel_nsuri = ''; |
| 458 |
|
} |
| 459 |
my $docel_def = $Element->{$docel_nsuri}->{$docel->manakai_local_name} || |
my $docel_def = $Element->{$docel_nsuri}->{$docel->manakai_local_name} || |
| 460 |
$Element->{$docel_nsuri}->{''} || |
$Element->{$docel_nsuri}->{''} || |
| 461 |
$ElementDefault; |
$ElementDefault; |
| 508 |
} elsif ($charset->{iana_names}->{'jis_x0212-1990'} or |
} elsif ($charset->{iana_names}->{'jis_x0212-1990'} or |
| 509 |
$charset->{iana_names}->{'x-jis0208'} or |
$charset->{iana_names}->{'x-jis0208'} or |
| 510 |
$charset->{iana_names}->{'utf-32'} or ## ISSUE: UTF-32BE? UTF-32LE? |
$charset->{iana_names}->{'utf-32'} or ## ISSUE: UTF-32BE? UTF-32LE? |
| 511 |
$charset->{is_ebcdic_based}) { |
($charset->{category} & Message::Charset::Info::CHARSET_CATEGORY_EBCDIC ())) { |
| 512 |
$onerror->(node => $doc, |
$onerror->(node => $doc, |
| 513 |
type => 'bad character encoding', |
type => 'bad character encoding', |
| 514 |
text => $charset_name, |
text => $charset_name, |
| 558 |
$self->{plus_elements} = {}; |
$self->{plus_elements} = {}; |
| 559 |
$self->{minus_elements} = {}; |
$self->{minus_elements} = {}; |
| 560 |
$self->{id} = {}; |
$self->{id} = {}; |
| 561 |
|
$self->{form} = {}; |
| 562 |
$self->{term} = {}; |
$self->{term} = {}; |
| 563 |
$self->{usemap} = []; |
$self->{usemap} = []; |
| 564 |
$self->{ref} = []; # datetemplate data references |
$self->{ref} = []; # datetemplate data references |
| 592 |
$code->(@$item); |
$code->(@$item); |
| 593 |
} elsif ($item->{type} eq 'element') { |
} elsif ($item->{type} eq 'element') { |
| 594 |
my $el_nsuri = $item->{node}->namespace_uri; |
my $el_nsuri = $item->{node}->namespace_uri; |
| 595 |
$el_nsuri = '' unless defined $el_nsuri; |
if (defined $el_nsuri) { |
| 596 |
|
load_ns_module ($el_nsuri); |
| 597 |
|
} else { |
| 598 |
|
$el_nsuri = ''; |
| 599 |
|
} |
| 600 |
my $el_ln = $item->{node}->manakai_local_name; |
my $el_ln = $item->{node}->manakai_local_name; |
| 601 |
|
|
|
load_ns_module ($el_nsuri); |
|
|
|
|
| 602 |
my $element_state = {}; |
my $element_state = {}; |
| 603 |
my $eldef = $Element->{$el_nsuri}->{$el_ln} || |
my $eldef = $Element->{$el_nsuri}->{$el_ln} || |
| 604 |
$Element->{$el_nsuri}->{''} || |
$Element->{$el_nsuri}->{''} || |
| 698 |
} |
} |
| 699 |
} elsif ($child_nt == 3 or # TEXT_NODE |
} elsif ($child_nt == 3 or # TEXT_NODE |
| 700 |
$child_nt == 4) { # CDATA_SECTION_NODE |
$child_nt == 4) { # CDATA_SECTION_NODE |
| 701 |
my $has_significant = ($child->data =~ /[^\x09-\x0D\x20]/); |
my $has_significant = ($child->data =~ /[^\x09\x0A\x0C\x0D\x20]/); |
| 702 |
push @new_item, [$content_def->{check_child_text}, |
push @new_item, [$content_def->{check_child_text}, |
| 703 |
$self, $item, $child, $has_significant, |
$self, $item, $child, $has_significant, |
| 704 |
$content_state, $element_state]; |
$content_state, $element_state]; |
| 788 |
delete $self->{minus_elements}; |
delete $self->{minus_elements}; |
| 789 |
delete $self->{onerror}; |
delete $self->{onerror}; |
| 790 |
delete $self->{id}; |
delete $self->{id}; |
| 791 |
|
delete $self->{form}; |
| 792 |
delete $self->{usemap}; |
delete $self->{usemap}; |
| 793 |
delete $self->{ref}; |
delete $self->{ref}; |
| 794 |
delete $self->{template}; |
delete $self->{template}; |
| 992 |
last CN; |
last CN; |
| 993 |
} |
} |
| 994 |
} elsif ($cnt == 3 or $cnt == 4) { |
} elsif ($cnt == 3 or $cnt == 4) { |
| 995 |
if ($cn->data =~ /[^\x09-\x0D\x20]/) { |
if ($cn->data =~ /[^\x09\x0A\x0C\x0D\x20]/) { |
| 996 |
last CN; |
last CN; |
| 997 |
} |
} |
| 998 |
} |
} |
| 1013 |
last CN; |
last CN; |
| 1014 |
} |
} |
| 1015 |
} elsif ($cnt == 3 or $cnt == 4) { |
} elsif ($cnt == 3 or $cnt == 4) { |
| 1016 |
if ($cn->data =~ /[^\x09-\x0D\x20]/) { |
if ($cn->data =~ /[^\x09\x0A\x0C\x0D\x20]/) { |
| 1017 |
last CN; |
last CN; |
| 1018 |
} |
} |
| 1019 |
} |
} |