/[suikacvs]/markup/html/whatpm/Whatpm/ContentChecker/Atom.pm
Suika

Diff of /markup/html/whatpm/Whatpm/ContentChecker/Atom.pm

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

revision 1.12 by wakaba, Thu Mar 20 08:23:42 2008 UTC revision 1.13 by wakaba, Thu Mar 20 08:27:38 2008 UTC
# Line 150  my %AtomTextConstruct = ( Line 150  my %AtomTextConstruct = (
150        die "atom:TextConstruct type error: $element_state->{type}";        die "atom:TextConstruct type error: $element_state->{type}";
151      }      }
152    },    },
   ## type=html  
       ## TODO: SHOULD be suitable for handling as HTML [HTML4]  
       ## TODO: HTML SHOULD be valid as if within <div>  
153    check_end => sub {    check_end => sub {
154      my ($self, $item, $element_state) = @_;      my ($self, $item, $element_state) = @_;
155      if ($element_state->{type} eq 'xhtml' and      if ($element_state->{type} eq 'xhtml') {
156          not $element_state->{has_div}) {        unless ($element_state->{has_div}) {
157        $self->{onerror}->(node => $item->{node},          $self->{onerror}->(node => $item->{node},
158                           type => 'element missing:div',                             type => 'element missing:div',
159                           level => $self->{must_level});                             level => $self->{must_level});
160          }
161        } elsif ($element_state->{type} eq 'html') {
162          ## TODO: SHOULD be suitable for handling as HTML [HTML4]
163          # markup MUST be escaped
164          $self->{onsubdoc}->({s => $element_state->{value},
165                               container_node => $item->{node},
166                               media_type => 'text/html',
167                               inner_html_element => 'div',
168                               is_char_string => 1});
169      }      }
170    
171      $AtomChecker{check_end}->(@_);      $AtomChecker{check_end}->(@_);
# Line 626  $Element->{$ATOM_NS}->{content} = { Line 632  $Element->{$ATOM_NS}->{content} = {
632    check_start => sub {    check_start => sub {
633      my ($self, $item, $element_state) = @_;      my ($self, $item, $element_state) = @_;
634      $element_state->{type} = 'text';      $element_state->{type} = 'text';
635      $element_state->{text} = '';      $element_state->{value} = '';
636    },    },
637    check_attrs => $GetAtomAttrsChecker->({    check_attrs => $GetAtomAttrsChecker->({
638      src => sub {      src => sub {
# Line 756  $Element->{$ATOM_NS}->{content} = { Line 762  $Element->{$ATOM_NS}->{content} = {
762        }        }
763      }      }
764    
765      $element_state->{text} .= $child_node->data;      $element_state->{value} .= $child_node->data;
766    
767      ## NOTE: type=text/* has no further restriction (i.e. the content don't      ## NOTE: type=text/* has no further restriction (i.e. the content don't
768      ## have to conform to the definition of the type).      ## have to conform to the definition of the type).
# Line 788  $Element->{$ATOM_NS}->{content} = { Line 794  $Element->{$ATOM_NS}->{content} = {
794      } elsif ($element_state->{type} eq 'html') {      } elsif ($element_state->{type} eq 'html') {
795        ## TODO: SHOULD be suitable for handling as HTML [HTML4]        ## TODO: SHOULD be suitable for handling as HTML [HTML4]
796        # markup MUST be escaped        # markup MUST be escaped
797        $self->{onsubdoc}->({s => $element_state->{text},        $self->{onsubdoc}->({s => $element_state->{value},
798                             container_node => $item->{node},                             container_node => $item->{node},
799                             media_type => 'text/html',                             media_type => 'text/html',
800                             inner_html_element => 'div',                             inner_html_element => 'div',

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24