33 |
}, |
}, |
34 |
lang => sub { |
lang => sub { |
35 |
my ($self, $attr) = @_; |
my ($self, $attr) = @_; |
36 |
|
my $value = $attr->value; |
37 |
|
if ($value eq '') { |
38 |
|
# |
39 |
|
} else { |
40 |
|
require Whatpm::LangTag; |
41 |
|
Whatpm::LangTag->check_rfc3066_language_tag ($value, sub { |
42 |
|
my %opt = @_; |
43 |
|
my $type = 'LangTag:'.$opt{type}; |
44 |
|
$type .= ':' . $opt{subtag} if defined $opt{subtag}; |
45 |
|
$self->{onerror}->(node => $attr, type => $type, |
46 |
|
value => $opt{value}, level => $opt{level}); |
47 |
|
}); |
48 |
|
} |
49 |
|
|
50 |
## NOTE: "The values of the attribute are language identifiers |
## NOTE: "The values of the attribute are language identifiers |
51 |
## as defined by [IETF RFC 3066], Tags for the Identification |
## as defined by [IETF RFC 3066], Tags for the Identification |
52 |
## of Languages, or its successor; in addition, the empty string |
## of Languages, or its successor; in addition, the empty string |
53 |
## may be specified." ("may" in lower case) |
## may be specified." ("may" in lower case) |
54 |
$self->{onerror}->(node => $attr, level => 'unsupported', |
## NOTE: Is an RFC 3066-valid (but RFC 4647-invalid) language tag |
55 |
type => 'language tag'); |
## allowed today? |
56 |
|
|
57 |
|
## TODO: test data |
58 |
|
|
59 |
if ($attr->owner_document->manakai_is_html) { # MUST NOT |
if ($attr->owner_document->manakai_is_html) { # MUST NOT |
60 |
$self->{onerror}->(node => $attr, type => 'in HTML:xml:lang'); |
$self->{onerror}->(node => $attr, type => 'in HTML:xml:lang'); |
61 |
## TODO: Test data... |
## TODO: Test data... |