/[suikacvs]/markup/html/whatpm/Whatpm/HTML.pm.src
Suika

Diff of /markup/html/whatpm/Whatpm/HTML.pm.src

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.113 by wakaba, Sun Mar 16 07:07:59 2008 UTC revision 1.115 by wakaba, Sun Mar 16 23:53:48 2008 UTC
# Line 108  sub parse_byte_string ($$$$;$) { Line 108  sub parse_byte_string ($$$$;$) {
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    
# Line 126  sub parse_byte_string ($$$$;$) { Line 127  sub parse_byte_string ($$$$;$) {
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) {
# Line 544  sub _get_next_token ($) { Line 545  sub _get_next_token ($) {
545            redo A;            redo A;
546          } elsif ($self->{next_char} == 0x003E) { # >          } elsif ($self->{next_char} == 0x003E) { # >
547            !!!cp (21);            !!!cp (21);
548            !!!parse-error (type => 'empty start tag');            !!!parse-error (type => 'empty start tag',
549                              line => $self->{line_prev},
550                              column => $self->{column_prev});
551            $self->{state} = DATA_STATE;            $self->{state} = DATA_STATE;
552            !!!next-input-character;            !!!next-input-character;
553    
# Line 555  sub _get_next_token ($) { Line 558  sub _get_next_token ($) {
558            redo A;            redo A;
559          } elsif ($self->{next_char} == 0x003F) { # ?          } elsif ($self->{next_char} == 0x003F) { # ?
560            !!!cp (22);            !!!cp (22);
561            !!!parse-error (type => 'pio');            !!!parse-error (type => 'pio',
562                              line => $self->{line_prev},
563                              column => $self->{column_prev});
564            $self->{state} = BOGUS_COMMENT_STATE;            $self->{state} = BOGUS_COMMENT_STATE;
565            $self->{current_token} = {type => COMMENT_TOKEN, data => '',            $self->{current_token} = {type => COMMENT_TOKEN, data => '',
566                                      line => $self->{line_prev},                                      line => $self->{line_prev},
# Line 659  sub _get_next_token ($) { Line 664  sub _get_next_token ($) {
664          redo A;          redo A;
665        } elsif ($self->{next_char} == 0x003E) { # >        } elsif ($self->{next_char} == 0x003E) { # >
666          !!!cp (31);          !!!cp (31);
667          !!!parse-error (type => 'empty end tag');          !!!parse-error (type => 'empty end tag',
668                            line => $self->{line_prev}, ## "<" in "</>"
669                            column => $self->{column_prev} - 1);
670          $self->{state} = DATA_STATE;          $self->{state} = DATA_STATE;
671          !!!next-input-character;          !!!next-input-character;
672          redo A;          redo A;
# Line 1651  sub _get_next_token ($) { Line 1658  sub _get_next_token ($) {
1658          redo A;          redo A;
1659        } elsif ($self->{next_char} == 0x002D) { # -        } elsif ($self->{next_char} == 0x002D) { # -
1660          !!!cp (152);          !!!cp (152);
1661          !!!parse-error (type => 'dash in comment');          !!!parse-error (type => 'dash in comment',
1662                            line => $self->{line_prev},
1663                            column => $self->{column_prev});
1664          $self->{current_token}->{data} .= '-'; # comment          $self->{current_token}->{data} .= '-'; # comment
1665          ## Stay in the state          ## Stay in the state
1666          !!!next-input-character;          !!!next-input-character;
# Line 1667  sub _get_next_token ($) { Line 1676  sub _get_next_token ($) {
1676          redo A;          redo A;
1677        } else {        } else {
1678          !!!cp (154);          !!!cp (154);
1679          !!!parse-error (type => 'dash in comment');          !!!parse-error (type => 'dash in comment',
1680                            line => $self->{line_prev},
1681                            column => $self->{column_prev});
1682          $self->{current_token}->{data} .= '--' . chr ($self->{next_char}); # comment          $self->{current_token}->{data} .= '--' . chr ($self->{next_char}); # comment
1683          $self->{state} = COMMENT_STATE;          $self->{state} = COMMENT_STATE;
1684          !!!next-input-character;          !!!next-input-character;
# Line 3535  sub _tree_construction_main ($) { Line 3546  sub _tree_construction_main ($) {
3546                  if ($token->{attributes}->{charset}) { ## TODO: And if supported                  if ($token->{attributes}->{charset}) { ## TODO: And if supported
3547                    !!!cp ('t106');                    !!!cp ('t106');
3548                    $self->{change_encoding}                    $self->{change_encoding}
3549                        ->($self, $token->{attributes}->{charset}->{value});                        ->($self, $token->{attributes}->{charset}->{value},
3550                             $token);
3551                                        
3552                    $meta_el->[0]->get_attribute_node_ns (undef, 'charset')                    $meta_el->[0]->get_attribute_node_ns (undef, 'charset')
3553                        ->set_user_data (manakai_has_reference =>                        ->set_user_data (manakai_has_reference =>
# Line 3550  sub _tree_construction_main ($) { Line 3562  sub _tree_construction_main ($) {
3562                            ([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) {                            ([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) {
3563                      !!!cp ('t107');                      !!!cp ('t107');
3564                      $self->{change_encoding}                      $self->{change_encoding}
3565                          ->($self, defined $1 ? $1 : defined $2 ? $2 : $3);                          ->($self, defined $1 ? $1 : defined $2 ? $2 : $3,
3566                               $token);
3567                      $meta_el->[0]->get_attribute_node_ns (undef, 'content')                      $meta_el->[0]->get_attribute_node_ns (undef, 'content')
3568                          ->set_user_data (manakai_has_reference =>                          ->set_user_data (manakai_has_reference =>
3569                                               $token->{attributes}->{content}                                               $token->{attributes}->{content}
# Line 3947  sub _tree_construction_main ($) { Line 3960  sub _tree_construction_main ($) {
3960    
3961                      ## Close the cell                      ## Close the cell
3962                      !!!back-token; # <?>                      !!!back-token; # <?>
3963                      $token = {type => END_TAG_TOKEN, tag_name => $node->[1]};                      $token = {type => END_TAG_TOKEN, tag_name => $node->[1],
3964                                  line => $token->{line},
3965                                  column => $token->{column}};
3966                      redo B;                      redo B;
3967                    } elsif ({                    } elsif ({
3968                              table => 1, html => 1,                              table => 1, html => 1,
# Line 4160  sub _tree_construction_main ($) { Line 4175  sub _tree_construction_main ($) {
4175    
4176                      ## Close the cell                      ## Close the cell
4177                      !!!back-token; # </?>                      !!!back-token; # </?>
4178                      $token = {type => END_TAG_TOKEN, tag_name => $tn};                      $token = {type => END_TAG_TOKEN, tag_name => $tn,
4179                                  line => $token->{line},
4180                                  column => $token->{column}};
4181                      redo B;                      redo B;
4182                    } elsif ($node->[1] eq 'td' or $node->[1] eq 'th') {                    } elsif ($node->[1] eq 'td' or $node->[1] eq 'th') {
4183                      !!!cp ('t180');                      !!!cp ('t180');
# Line 5557  sub _tree_construction_main ($) { Line 5574  sub _tree_construction_main ($) {
5574            if ($token->{attributes}->{charset}) { ## TODO: And if supported            if ($token->{attributes}->{charset}) { ## TODO: And if supported
5575              !!!cp ('t335');              !!!cp ('t335');
5576              $self->{change_encoding}              $self->{change_encoding}
5577                  ->($self, $token->{attributes}->{charset}->{value});                  ->($self, $token->{attributes}->{charset}->{value}, $token);
5578                            
5579              $meta_el->[0]->get_attribute_node_ns (undef, 'charset')              $meta_el->[0]->get_attribute_node_ns (undef, 'charset')
5580                  ->set_user_data (manakai_has_reference =>                  ->set_user_data (manakai_has_reference =>
# Line 5572  sub _tree_construction_main ($) { Line 5589  sub _tree_construction_main ($) {
5589                      ([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) {                      ([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) {
5590                !!!cp ('t336');                !!!cp ('t336');
5591                $self->{change_encoding}                $self->{change_encoding}
5592                    ->($self, defined $1 ? $1 : defined $2 ? $2 : $3);                    ->($self, defined $1 ? $1 : defined $2 ? $2 : $3, $token);
5593                $meta_el->[0]->get_attribute_node_ns (undef, 'content')                $meta_el->[0]->get_attribute_node_ns (undef, 'content')
5594                    ->set_user_data (manakai_has_reference =>                    ->set_user_data (manakai_has_reference =>
5595                                         $token->{attributes}->{content}                                         $token->{attributes}->{content}
# Line 5646  sub _tree_construction_main ($) { Line 5663  sub _tree_construction_main ($) {
5663            if ($_->[1] eq 'p') {            if ($_->[1] eq 'p') {
5664              !!!cp ('t344');              !!!cp ('t344');
5665              !!!back-token;              !!!back-token;
5666              $token = {type => END_TAG_TOKEN, tag_name => 'p'};              $token = {type => END_TAG_TOKEN, tag_name => 'p',
5667                          line => $token->{line}, column => $token->{column}};
5668              redo B;              redo B;
5669            } elsif ({            } elsif ({
5670                      applet => 1, table => 1, caption => 1, td => 1, th => 1,                      applet => 1, table => 1, caption => 1, td => 1, th => 1,
# Line 5699  sub _tree_construction_main ($) { Line 5717  sub _tree_construction_main ($) {
5717            if ($_->[1] eq 'p') {            if ($_->[1] eq 'p') {
5718              !!!cp ('t353');              !!!cp ('t353');
5719              !!!back-token;              !!!back-token;
5720              $token = {type => END_TAG_TOKEN, tag_name => 'p'};              $token = {type => END_TAG_TOKEN, tag_name => 'p',
5721                          line => $token->{line}, column => $token->{column}};
5722              redo B;              redo B;
5723            } elsif ({            } elsif ({
5724                      applet => 1, table => 1, caption => 1, td => 1, th => 1,                      applet => 1, table => 1, caption => 1, td => 1, th => 1,
# Line 5758  sub _tree_construction_main ($) { Line 5777  sub _tree_construction_main ($) {
5777            if ($_->[1] eq 'p') {            if ($_->[1] eq 'p') {
5778              !!!cp ('t367');              !!!cp ('t367');
5779              !!!back-token;              !!!back-token;
5780              $token = {type => END_TAG_TOKEN, tag_name => 'p'};              $token = {type => END_TAG_TOKEN, tag_name => 'p',
5781                          line => $token->{line}, column => $token->{column}};
5782              redo B;              redo B;
5783            } elsif ({            } elsif ({
5784                      applet => 1, table => 1, caption => 1, td => 1, th => 1,                      applet => 1, table => 1, caption => 1, td => 1, th => 1,
# Line 5783  sub _tree_construction_main ($) { Line 5803  sub _tree_construction_main ($) {
5803              !!!parse-error (type => 'in a:a', token => $token);              !!!parse-error (type => 'in a:a', token => $token);
5804                            
5805              !!!back-token;              !!!back-token;
5806              $token = {type => END_TAG_TOKEN, tag_name => 'a'};              $token = {type => END_TAG_TOKEN, tag_name => 'a',
5807                          line => $token->{line}, column => $token->{column}};
5808              $formatting_end_tag->($token);              $formatting_end_tag->($token);
5809                            
5810              AFE2: for (reverse 0..$#$active_formatting_elements) {              AFE2: for (reverse 0..$#$active_formatting_elements) {
# Line 5824  sub _tree_construction_main ($) { Line 5845  sub _tree_construction_main ($) {
5845              !!!cp ('t376');              !!!cp ('t376');
5846              !!!parse-error (type => 'in nobr:nobr', token => $token);              !!!parse-error (type => 'in nobr:nobr', token => $token);
5847              !!!back-token;              !!!back-token;
5848              $token = {type => END_TAG_TOKEN, tag_name => 'nobr'};              $token = {type => END_TAG_TOKEN, tag_name => 'nobr',
5849                          line => $token->{line}, column => $token->{column}};
5850              redo B;              redo B;
5851            } elsif ({            } elsif ({
5852                      applet => 1, table => 1, caption => 1, td => 1, th => 1,                      applet => 1, table => 1, caption => 1, td => 1, th => 1,
# Line 5848  sub _tree_construction_main ($) { Line 5870  sub _tree_construction_main ($) {
5870              !!!cp ('t378');              !!!cp ('t378');
5871              !!!parse-error (type => 'in button:button', token => $token);              !!!parse-error (type => 'in button:button', token => $token);
5872              !!!back-token;              !!!back-token;
5873              $token = {type => END_TAG_TOKEN, tag_name => 'button'};              $token = {type => END_TAG_TOKEN, tag_name => 'button',
5874                          line => $token->{line}, column => $token->{column}};
5875              redo B;              redo B;
5876            } elsif ({            } elsif ({
5877                      applet => 1, table => 1, caption => 1, td => 1, th => 1,                      applet => 1, table => 1, caption => 1, td => 1, th => 1,
# Line 5903  sub _tree_construction_main ($) { Line 5926  sub _tree_construction_main ($) {
5926            delete $at->{prompt};            delete $at->{prompt};
5927            my @tokens = (            my @tokens = (
5928                          {type => START_TAG_TOKEN, tag_name => 'form',                          {type => START_TAG_TOKEN, tag_name => 'form',
5929                           attributes => $form_attrs},                           attributes => $form_attrs,
5930                          {type => START_TAG_TOKEN, tag_name => 'hr'},                           line => $token->{line}, column => $token->{column}},
5931                          {type => START_TAG_TOKEN, tag_name => 'p'},                          {type => START_TAG_TOKEN, tag_name => 'hr',
5932                          {type => START_TAG_TOKEN, tag_name => 'label'},                           line => $token->{line}, column => $token->{column}},
5933                            {type => START_TAG_TOKEN, tag_name => 'p',
5934                             line => $token->{line}, column => $token->{column}},
5935                            {type => START_TAG_TOKEN, tag_name => 'label',
5936                             line => $token->{line}, column => $token->{column}},
5937                         );                         );
5938            if ($prompt_attr) {            if ($prompt_attr) {
5939              !!!cp ('t390');              !!!cp ('t390');
5940              push @tokens, {type => CHARACTER_TOKEN, data => $prompt_attr->{value}};              push @tokens, {type => CHARACTER_TOKEN, data => $prompt_attr->{value},
5941                               line => $token->{line}, column => $token->{column}};
5942            } else {            } else {
5943              !!!cp ('t391');              !!!cp ('t391');
5944              push @tokens, {type => CHARACTER_TOKEN,              push @tokens, {type => CHARACTER_TOKEN,
5945                             data => 'This is a searchable index. Insert your search keywords here: '}; # SHOULD                             data => 'This is a searchable index. Insert your search keywords here: ',
5946                               line => $token->{line}, column => $token->{column}}; # SHOULD
5947              ## TODO: make this configurable              ## TODO: make this configurable
5948            }            }
5949            push @tokens,            push @tokens,
5950                          {type => START_TAG_TOKEN, tag_name => 'input', attributes => $at},                          {type => START_TAG_TOKEN, tag_name => 'input', attributes => $at,
5951                             line => $token->{line}, column => $token->{column}},
5952                          #{type => CHARACTER_TOKEN, data => ''}, # SHOULD                          #{type => CHARACTER_TOKEN, data => ''}, # SHOULD
5953                          {type => END_TAG_TOKEN, tag_name => 'label'},                          {type => END_TAG_TOKEN, tag_name => 'label',
5954                          {type => END_TAG_TOKEN, tag_name => 'p'},                           line => $token->{line}, column => $token->{column}},
5955                          {type => START_TAG_TOKEN, tag_name => 'hr'},                          {type => END_TAG_TOKEN, tag_name => 'p',
5956                          {type => END_TAG_TOKEN, tag_name => 'form'};                           line => $token->{line}, column => $token->{column}},
5957                            {type => START_TAG_TOKEN, tag_name => 'hr',
5958                             line => $token->{line}, column => $token->{column}},
5959                            {type => END_TAG_TOKEN, tag_name => 'form',
5960                             line => $token->{line}, column => $token->{column}};
5961            $token = shift @tokens;            $token = shift @tokens;
5962            !!!back-token (@tokens);            !!!back-token (@tokens);
5963            redo B;            redo B;

Legend:
Removed from v.1.113  
changed lines
  Added in v.1.115

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24