108 |
$self->{change_encoding} = sub { |
$self->{change_encoding} = sub { |
109 |
my $self = shift; |
my $self = shift; |
110 |
my $charset = lc shift; |
my $charset = lc shift; |
111 |
|
my $token = shift; |
112 |
## TODO: if $charset is supported |
## TODO: if $charset is supported |
113 |
## TODO: normalize charset name |
## TODO: normalize charset name |
114 |
|
|
127 |
} |
} |
128 |
|
|
129 |
!!!parse-error (type => 'charset label detected:'.$self->{input_encoding}. |
!!!parse-error (type => 'charset label detected:'.$self->{input_encoding}. |
130 |
':'.$charset, level => 'w'); |
':'.$charset, level => 'w', token => $token); |
131 |
|
|
132 |
## Step 3 |
## Step 3 |
133 |
# if (can) { |
# if (can) { |
1652 |
redo A; |
redo A; |
1653 |
} elsif ($self->{next_char} == 0x002D) { # - |
} elsif ($self->{next_char} == 0x002D) { # - |
1654 |
!!!cp (152); |
!!!cp (152); |
1655 |
!!!parse-error (type => 'dash in comment'); |
!!!parse-error (type => 'dash in comment', |
1656 |
|
line => $self->{line_prev}, |
1657 |
|
column => $self->{column_prev}); |
1658 |
$self->{current_token}->{data} .= '-'; # comment |
$self->{current_token}->{data} .= '-'; # comment |
1659 |
## Stay in the state |
## Stay in the state |
1660 |
!!!next-input-character; |
!!!next-input-character; |
1670 |
redo A; |
redo A; |
1671 |
} else { |
} else { |
1672 |
!!!cp (154); |
!!!cp (154); |
1673 |
!!!parse-error (type => 'dash in comment'); |
!!!parse-error (type => 'dash in comment', |
1674 |
|
line => $self->{line_prev}, |
1675 |
|
column => $self->{column_prev}); |
1676 |
$self->{current_token}->{data} .= '--' . chr ($self->{next_char}); # comment |
$self->{current_token}->{data} .= '--' . chr ($self->{next_char}); # comment |
1677 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
1678 |
!!!next-input-character; |
!!!next-input-character; |
3540 |
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
3541 |
!!!cp ('t106'); |
!!!cp ('t106'); |
3542 |
$self->{change_encoding} |
$self->{change_encoding} |
3543 |
->($self, $token->{attributes}->{charset}->{value}); |
->($self, $token->{attributes}->{charset}->{value}, |
3544 |
|
$token); |
3545 |
|
|
3546 |
$meta_el->[0]->get_attribute_node_ns (undef, 'charset') |
$meta_el->[0]->get_attribute_node_ns (undef, 'charset') |
3547 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
3556 |
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
3557 |
!!!cp ('t107'); |
!!!cp ('t107'); |
3558 |
$self->{change_encoding} |
$self->{change_encoding} |
3559 |
->($self, defined $1 ? $1 : defined $2 ? $2 : $3); |
->($self, defined $1 ? $1 : defined $2 ? $2 : $3, |
3560 |
|
$token); |
3561 |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
3562 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
3563 |
$token->{attributes}->{content} |
$token->{attributes}->{content} |
3954 |
|
|
3955 |
## Close the cell |
## Close the cell |
3956 |
!!!back-token; # <?> |
!!!back-token; # <?> |
3957 |
$token = {type => END_TAG_TOKEN, tag_name => $node->[1]}; |
$token = {type => END_TAG_TOKEN, tag_name => $node->[1], |
3958 |
|
line => $token->{line}, |
3959 |
|
column => $token->{column}}; |
3960 |
redo B; |
redo B; |
3961 |
} elsif ({ |
} elsif ({ |
3962 |
table => 1, html => 1, |
table => 1, html => 1, |
4169 |
|
|
4170 |
## Close the cell |
## Close the cell |
4171 |
!!!back-token; # </?> |
!!!back-token; # </?> |
4172 |
$token = {type => END_TAG_TOKEN, tag_name => $tn}; |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
4173 |
|
line => $token->{line}, |
4174 |
|
column => $token->{column}}; |
4175 |
redo B; |
redo B; |
4176 |
} elsif ($node->[1] eq 'td' or $node->[1] eq 'th') { |
} elsif ($node->[1] eq 'td' or $node->[1] eq 'th') { |
4177 |
!!!cp ('t180'); |
!!!cp ('t180'); |
5568 |
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
5569 |
!!!cp ('t335'); |
!!!cp ('t335'); |
5570 |
$self->{change_encoding} |
$self->{change_encoding} |
5571 |
->($self, $token->{attributes}->{charset}->{value}); |
->($self, $token->{attributes}->{charset}->{value}, $token); |
5572 |
|
|
5573 |
$meta_el->[0]->get_attribute_node_ns (undef, 'charset') |
$meta_el->[0]->get_attribute_node_ns (undef, 'charset') |
5574 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
5583 |
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
5584 |
!!!cp ('t336'); |
!!!cp ('t336'); |
5585 |
$self->{change_encoding} |
$self->{change_encoding} |
5586 |
->($self, defined $1 ? $1 : defined $2 ? $2 : $3); |
->($self, defined $1 ? $1 : defined $2 ? $2 : $3, $token); |
5587 |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
5588 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
5589 |
$token->{attributes}->{content} |
$token->{attributes}->{content} |
5657 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5658 |
!!!cp ('t344'); |
!!!cp ('t344'); |
5659 |
!!!back-token; |
!!!back-token; |
5660 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
5661 |
|
line => $token->{line}, column => $token->{column}}; |
5662 |
redo B; |
redo B; |
5663 |
} elsif ({ |
} elsif ({ |
5664 |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
5711 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5712 |
!!!cp ('t353'); |
!!!cp ('t353'); |
5713 |
!!!back-token; |
!!!back-token; |
5714 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
5715 |
|
line => $token->{line}, column => $token->{column}}; |
5716 |
redo B; |
redo B; |
5717 |
} elsif ({ |
} elsif ({ |
5718 |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
5771 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5772 |
!!!cp ('t367'); |
!!!cp ('t367'); |
5773 |
!!!back-token; |
!!!back-token; |
5774 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
5775 |
|
line => $token->{line}, column => $token->{column}}; |
5776 |
redo B; |
redo B; |
5777 |
} elsif ({ |
} elsif ({ |
5778 |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
5797 |
!!!parse-error (type => 'in a:a', token => $token); |
!!!parse-error (type => 'in a:a', token => $token); |
5798 |
|
|
5799 |
!!!back-token; |
!!!back-token; |
5800 |
$token = {type => END_TAG_TOKEN, tag_name => 'a'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'a', |
5801 |
|
line => $token->{line}, column => $token->{column}}; |
5802 |
$formatting_end_tag->($token); |
$formatting_end_tag->($token); |
5803 |
|
|
5804 |
AFE2: for (reverse 0..$#$active_formatting_elements) { |
AFE2: for (reverse 0..$#$active_formatting_elements) { |
5839 |
!!!cp ('t376'); |
!!!cp ('t376'); |
5840 |
!!!parse-error (type => 'in nobr:nobr', token => $token); |
!!!parse-error (type => 'in nobr:nobr', token => $token); |
5841 |
!!!back-token; |
!!!back-token; |
5842 |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
5843 |
|
line => $token->{line}, column => $token->{column}}; |
5844 |
redo B; |
redo B; |
5845 |
} elsif ({ |
} elsif ({ |
5846 |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
5864 |
!!!cp ('t378'); |
!!!cp ('t378'); |
5865 |
!!!parse-error (type => 'in button:button', token => $token); |
!!!parse-error (type => 'in button:button', token => $token); |
5866 |
!!!back-token; |
!!!back-token; |
5867 |
$token = {type => END_TAG_TOKEN, tag_name => 'button'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
5868 |
|
line => $token->{line}, column => $token->{column}}; |
5869 |
redo B; |
redo B; |
5870 |
} elsif ({ |
} elsif ({ |
5871 |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
5920 |
delete $at->{prompt}; |
delete $at->{prompt}; |
5921 |
my @tokens = ( |
my @tokens = ( |
5922 |
{type => START_TAG_TOKEN, tag_name => 'form', |
{type => START_TAG_TOKEN, tag_name => 'form', |
5923 |
attributes => $form_attrs}, |
attributes => $form_attrs, |
5924 |
{type => START_TAG_TOKEN, tag_name => 'hr'}, |
line => $token->{line}, column => $token->{column}}, |
5925 |
{type => START_TAG_TOKEN, tag_name => 'p'}, |
{type => START_TAG_TOKEN, tag_name => 'hr', |
5926 |
{type => START_TAG_TOKEN, tag_name => 'label'}, |
line => $token->{line}, column => $token->{column}}, |
5927 |
|
{type => START_TAG_TOKEN, tag_name => 'p', |
5928 |
|
line => $token->{line}, column => $token->{column}}, |
5929 |
|
{type => START_TAG_TOKEN, tag_name => 'label', |
5930 |
|
line => $token->{line}, column => $token->{column}}, |
5931 |
); |
); |
5932 |
if ($prompt_attr) { |
if ($prompt_attr) { |
5933 |
!!!cp ('t390'); |
!!!cp ('t390'); |
5934 |
push @tokens, {type => CHARACTER_TOKEN, data => $prompt_attr->{value}}; |
push @tokens, {type => CHARACTER_TOKEN, data => $prompt_attr->{value}, |
5935 |
|
line => $token->{line}, column => $token->{column}}; |
5936 |
} else { |
} else { |
5937 |
!!!cp ('t391'); |
!!!cp ('t391'); |
5938 |
push @tokens, {type => CHARACTER_TOKEN, |
push @tokens, {type => CHARACTER_TOKEN, |
5939 |
data => 'This is a searchable index. Insert your search keywords here: '}; # SHOULD |
data => 'This is a searchable index. Insert your search keywords here: ', |
5940 |
|
line => $token->{line}, column => $token->{column}}; # SHOULD |
5941 |
## TODO: make this configurable |
## TODO: make this configurable |
5942 |
} |
} |
5943 |
push @tokens, |
push @tokens, |
5944 |
{type => START_TAG_TOKEN, tag_name => 'input', attributes => $at}, |
{type => START_TAG_TOKEN, tag_name => 'input', attributes => $at, |
5945 |
|
line => $token->{line}, column => $token->{column}}, |
5946 |
#{type => CHARACTER_TOKEN, data => ''}, # SHOULD |
#{type => CHARACTER_TOKEN, data => ''}, # SHOULD |
5947 |
{type => END_TAG_TOKEN, tag_name => 'label'}, |
{type => END_TAG_TOKEN, tag_name => 'label', |
5948 |
{type => END_TAG_TOKEN, tag_name => 'p'}, |
line => $token->{line}, column => $token->{column}}, |
5949 |
{type => START_TAG_TOKEN, tag_name => 'hr'}, |
{type => END_TAG_TOKEN, tag_name => 'p', |
5950 |
{type => END_TAG_TOKEN, tag_name => 'form'}; |
line => $token->{line}, column => $token->{column}}, |
5951 |
|
{type => START_TAG_TOKEN, tag_name => 'hr', |
5952 |
|
line => $token->{line}, column => $token->{column}}, |
5953 |
|
{type => END_TAG_TOKEN, tag_name => 'form', |
5954 |
|
line => $token->{line}, column => $token->{column}}; |
5955 |
$token = shift @tokens; |
$token = shift @tokens; |
5956 |
!!!back-token (@tokens); |
!!!back-token (@tokens); |
5957 |
redo B; |
redo B; |