/[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.65 by wakaba, Mon Nov 19 12:18:26 2007 UTC revision 1.66 by wakaba, Fri Nov 23 07:35:02 2007 UTC
# Line 340  sub _initialize_tokenizer ($) { Line 340  sub _initialize_tokenizer ($) {
340  ##   ->{system_identifier} (DOCTYPE_TOKEN)  ##   ->{system_identifier} (DOCTYPE_TOKEN)
341  ##   ->{correct} == 1 or 0 (DOCTYPE_TOKEN)  ##   ->{correct} == 1 or 0 (DOCTYPE_TOKEN)
342  ##   ->{attributes} isa HASH (START_TAG_TOKEN, END_TAG_TOKEN)  ##   ->{attributes} isa HASH (START_TAG_TOKEN, END_TAG_TOKEN)
343    ##        ->{name}
344    ##        ->{value}
345    ##        ->{has_reference} == 1 or 0
346  ##   ->{data} (COMMENT_TOKEN, CHARACTER_TOKEN)  ##   ->{data} (COMMENT_TOKEN, CHARACTER_TOKEN)
347    
348  ## Emitted token MUST immediately be handled by the tree construction state.  ## Emitted token MUST immediately be handled by the tree construction state.
# Line 1115  sub _get_next_token ($) { Line 1118  sub _get_next_token ($) {
1118          $self->{current_attribute}->{value} .= '&';          $self->{current_attribute}->{value} .= '&';
1119        } else {        } else {
1120          $self->{current_attribute}->{value} .= $token->{data};          $self->{current_attribute}->{value} .= $token->{data};
1121            $self->{current_attribute}->{has_reference} = $token->{has_reference};
1122          ## ISSUE: spec says "append the returned character token to the current attribute's value"          ## ISSUE: spec says "append the returned character token to the current attribute's value"
1123        }        }
1124    
# Line 1841  sub _tokenize_attempt_to_consume_an_enti Line 1845  sub _tokenize_attempt_to_consume_an_enti
1845            $code = $c1_entity_char->{$code};            $code = $c1_entity_char->{$code};
1846          }          }
1847    
1848          return {type => CHARACTER_TOKEN, data => chr $code};          return {type => CHARACTER_TOKEN, data => chr $code,
1849                    has_reference => 1};
1850        } # X        } # X
1851      } elsif (0x0030 <= $self->{next_input_character} and      } elsif (0x0030 <= $self->{next_input_character} and
1852               $self->{next_input_character} <= 0x0039) { # 0..9               $self->{next_input_character} <= 0x0039) { # 0..9
# Line 1876  sub _tokenize_attempt_to_consume_an_enti Line 1881  sub _tokenize_attempt_to_consume_an_enti
1881          $code = $c1_entity_char->{$code};          $code = $c1_entity_char->{$code};
1882        }        }
1883                
1884        return {type => CHARACTER_TOKEN, data => chr $code};        return {type => CHARACTER_TOKEN, data => chr $code, has_reference => 1};
1885      } else {      } else {
1886        !!!parse-error (type => 'bare nero');        !!!parse-error (type => 'bare nero');
1887        !!!back-next-input-character ($self->{next_input_character});        !!!back-next-input-character ($self->{next_input_character});
# Line 1924  sub _tokenize_attempt_to_consume_an_enti Line 1929  sub _tokenize_attempt_to_consume_an_enti
1929      }      }
1930            
1931      if ($match > 0) {      if ($match > 0) {
1932        return {type => CHARACTER_TOKEN, data => $value};        return {type => CHARACTER_TOKEN, data => $value, has_reference => 1};
1933      } elsif ($match < 0) {      } elsif ($match < 0) {
1934        !!!parse-error (type => 'no refc');        !!!parse-error (type => 'no refc');
1935        if ($in_attr and $match < -1) {        if ($in_attr and $match < -1) {
1936          return {type => CHARACTER_TOKEN, data => '&'.$entity_name};          return {type => CHARACTER_TOKEN, data => '&'.$entity_name};
1937        } else {        } else {
1938          return {type => CHARACTER_TOKEN, data => $value};          return {type => CHARACTER_TOKEN, data => $value, has_reference => 1};
1939        }        }
1940      } else {      } else {
1941        !!!parse-error (type => 'bare ero');        !!!parse-error (type => 'bare ero');
1942        ## NOTE: No characters are consumed in the spec.        ## NOTE: "No characters are consumed" in the spec.
1943        return {type => CHARACTER_TOKEN, data => '&'.$value};        return {type => CHARACTER_TOKEN, data => '&'.$value};
1944      }      }
1945    } else {    } else {
# Line 2866  sub _tree_construction_main ($) { Line 2871  sub _tree_construction_main ($) {
2871                  push @{$self->{open_elements}}, [$self->{head_element}, 'head'];                  push @{$self->{open_elements}}, [$self->{head_element}, 'head'];
2872                }                }
2873                !!!insert-element ($token->{tag_name}, $token->{attributes});                !!!insert-element ($token->{tag_name}, $token->{attributes});
2874                pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec.                my $meta_el = pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec.
2875    
2876                unless ($self->{confident}) {                unless ($self->{confident}) {
2877                  if ($token->{attributes}->{charset}) { ## TODO: And if supported                  if ($token->{attributes}->{charset}) { ## TODO: And if supported
2878                    $self->{change_encoding}                    $self->{change_encoding}
2879                        ->($self, $token->{attributes}->{charset}->{value});                        ->($self, $token->{attributes}->{charset}->{value});
2880                      
2881                      $meta_el->[0]->get_attribute_node_ns (undef, 'charset')
2882                          ->set_user_data (manakai_has_reference =>
2883                                               $token->{attributes}->{charset}
2884                                                   ->{has_reference});
2885                  } elsif ($token->{attributes}->{content}) {                  } elsif ($token->{attributes}->{content}) {
2886                    ## ISSUE: Algorithm name in the spec was incorrect so that not linked to the definition.                    ## ISSUE: Algorithm name in the spec was incorrect so that not linked to the definition.
2887                    if ($token->{attributes}->{content}->{value}                    if ($token->{attributes}->{content}->{value}
# Line 2882  sub _tree_construction_main ($) { Line 2892  sub _tree_construction_main ($) {
2892                          ->($self, defined $1 ? $1 : defined $2 ? $2 : $3);                          ->($self, defined $1 ? $1 : defined $2 ? $2 : $3);
2893                    }                    }
2894                  }                  }
2895                  } else {
2896                    if ($token->{attributes}->{charset}) {
2897                      $meta_el->[0]->get_attribute_node_ns (undef, 'charset')
2898                          ->set_user_data (manakai_has_reference =>
2899                                               $token->{attributes}->{charset}
2900                                                   ->{has_reference});
2901                    }
2902                }                }
2903    
2904                pop @{$self->{open_elements}}                pop @{$self->{open_elements}}
# Line 4454  sub _tree_construction_main ($) { Line 4471  sub _tree_construction_main ($) {
4471        } elsif ($token->{tag_name} eq 'meta') {        } elsif ($token->{tag_name} eq 'meta') {
4472          ## NOTE: This is an "as if in head" code clone, only "-t" differs          ## NOTE: This is an "as if in head" code clone, only "-t" differs
4473          !!!insert-element-t ($token->{tag_name}, $token->{attributes});          !!!insert-element-t ($token->{tag_name}, $token->{attributes});
4474          pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec.          my $meta_el = pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec.
4475    
4476          unless ($self->{confident}) {          unless ($self->{confident}) {
4477            if ($token->{attributes}->{charset}) { ## TODO: And if supported            if ($token->{attributes}->{charset}) { ## TODO: And if supported
4478              $self->{change_encoding}              $self->{change_encoding}
4479                  ->($self, $token->{attributes}->{charset}->{value});                  ->($self, $token->{attributes}->{charset}->{value});
4480                
4481                $meta_el->[0]->get_attribute_node_ns (undef, 'charset')
4482                    ->set_user_data (manakai_has_reference =>
4483                                         $token->{attributes}->{charset}
4484                                             ->{has_reference});
4485            } elsif ($token->{attributes}->{content}) {            } elsif ($token->{attributes}->{content}) {
4486              ## ISSUE: Algorithm name in the spec was incorrect so that not linked to the definition.              ## ISSUE: Algorithm name in the spec was incorrect so that not linked to the definition.
4487              if ($token->{attributes}->{content}->{value}              if ($token->{attributes}->{content}->{value}
# Line 4470  sub _tree_construction_main ($) { Line 4492  sub _tree_construction_main ($) {
4492                    ->($self, defined $1 ? $1 : defined $2 ? $2 : $3);                    ->($self, defined $1 ? $1 : defined $2 ? $2 : $3);
4493              }              }
4494            }            }
4495            } else {
4496              if ($token->{attributes}->{charset}) {
4497                $meta_el->[0]->get_attribute_node_ns (undef, 'charset')
4498                    ->set_user_data (manakai_has_reference =>
4499                                         $token->{attributes}->{charset}
4500                                             ->{has_reference});
4501              }
4502          }          }
4503    
4504          !!!next-token;          !!!next-token;

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24