/[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.5 by wakaba, Sat Sep 29 04:45:10 2007 UTC revision 1.6 by wakaba, Sun Oct 14 09:21:46 2007 UTC
# Line 285  $Element->{$ATOM_NS}->{uri} = { Line 285  $Element->{$ATOM_NS}->{uri} = {
285                    
286        my $nt = $node->node_type;        my $nt = $node->node_type;
287        if ($nt == 1) {        if ($nt == 1) {
288          ## NOTE: Not explicitly disallowed.          my $node_ns = $node->namespace_uri;
289          $self->{onerror}->(node => $node, type => 'element not allowed');          $node_ns = '' unless defined $node_ns;
290            my $node_ln = $node->manakai_local_name;
291            unless ($self->{pluses}->{$node_ns}->{$node_ln}) {
292              ## NOTE: Not explicitly disallowed.
293              $self->{onerror}->(node => $node, type => 'element not allowed');
294            }
295          my ($sib, $ch) = $self->_check_get_children ($node, $todo);          my ($sib, $ch) = $self->_check_get_children ($node, $todo);
296          unshift @nodes, @$sib;          unshift @nodes, @$sib;
297          push @$new_todos, @$ch;          push @$new_todos, @$ch;
# Line 326  $Element->{$ATOM_NS}->{email} = { Line 331  $Element->{$ATOM_NS}->{email} = {
331                    
332        my $nt = $node->node_type;        my $nt = $node->node_type;
333        if ($nt == 1) {        if ($nt == 1) {
334          ## NOTE: Not explicitly disallowed.          my $node_ns = $node->namespace_uri;
335          $self->{onerror}->(node => $node, type => 'element not allowed');          $node_ns = '' unless defined $node_ns;
336            my $node_ln = $node->manakai_local_name;
337            unless ($self->{pluses}->{$node_ns}->{$node_ln}) {
338              ## NOTE: Not explicitly disallowed.
339              $self->{onerror}->(node => $node, type => 'element not allowed');
340            }
341          my ($sib, $ch) = $self->_check_get_children ($node, $todo);          my ($sib, $ch) = $self->_check_get_children ($node, $todo);
342          unshift @nodes, @$sib;          unshift @nodes, @$sib;
343          push @$new_todos, @$ch;          push @$new_todos, @$ch;
# Line 362  my $AtomDateConstruct = { Line 372  my $AtomDateConstruct = {
372                    
373        my $nt = $node->node_type;        my $nt = $node->node_type;
374        if ($nt == 1) {        if ($nt == 1) {
375          ## NOTE: It does not explicitly say that there MUST NOT be any element.          my $node_ns = $node->namespace_uri;
376          $self->{onerror}->(node => $node, type => 'element not allowed');          $node_ns = '' unless defined $node_ns;
377            my $node_ln = $node->manakai_local_name;
378            unless ($self->{pluses}->{$node_ns}->{$node_ln}) {
379              ## NOTE: It does not explicitly say that there MUST NOT be any element.
380              $self->{onerror}->(node => $node, type => 'element not allowed');
381            }
382          my ($sib, $ch) = $self->_check_get_children ($node, $todo);          my ($sib, $ch) = $self->_check_get_children ($node, $todo);
383          unshift @nodes, @$sib;          unshift @nodes, @$sib;
384          push @$new_todos, @$ch;          push @$new_todos, @$ch;
# Line 440  $Element->{$ATOM_NS}->{entry} = { Line 455  $Element->{$ATOM_NS}->{entry} = {
455          # MUST          # MUST
456          my $nsuri = $node->namespace_uri;          my $nsuri = $node->namespace_uri;
457          $nsuri = '' unless defined $nsuri;          $nsuri = '' unless defined $nsuri;
458            my $ln = $node->manakai_local_name;
459          my $not_allowed;          my $not_allowed;
460          if ($nsuri eq $ATOM_NS) {          if ($self->{pluses}->{$nsuri}->{$ln}) {
461            my $ln = $node->manakai_local_name;            #
462            } elsif ($nsuri eq $ATOM_NS) {
463            if ({ # MUST (0, 1)            if ({ # MUST (0, 1)
464                 content => 1,                 content => 1,
465                 id => 1,                 id => 1,
# Line 550  $Element->{$ATOM_NS}->{feed} = { Line 567  $Element->{$ATOM_NS}->{feed} = {
567        if ($nt == 1) {        if ($nt == 1) {
568          my $nsuri = $node->namespace_uri;          my $nsuri = $node->namespace_uri;
569          $nsuri = '' unless defined $nsuri;          $nsuri = '' unless defined $nsuri;
570            my $ln = $node->manakai_local_name;
571          my $not_allowed;          my $not_allowed;
572          if ($nsuri eq $ATOM_NS) {          if ($self->{pluses}->{$nsuri}->{$ln}) {
573            my $ln = $node->manakai_local_name;            #
574            } elsif ($nsuri eq $ATOM_NS) {
575            if ($ln eq 'entry') {            if ($ln eq 'entry') {
576              $has_element->{entry} = 1;              $has_element->{entry} = 1;
577            } elsif ({ # MUST (0, 1)            } elsif ({ # MUST (0, 1)
# Line 724  $Element->{$ATOM_NS}->{content} = { Line 743  $Element->{$ATOM_NS}->{content} = {
743                    
744          my $nt = $node->node_type;          my $nt = $node->node_type;
745          if ($nt == 1) {          if ($nt == 1) {
746            # MUST NOT            my $node_ns = $node->namespace_uri;
747            $self->{onerror}->(node => $node, type => 'element not allowed');            $node_ns = '' unless defined $node_ns;
748              my $node_ln = $node->manakai_local_name;
749              if ($self->{pluses}->{$node_ns}->{$node_ln}) {
750                #
751              } else {
752                # MUST NOT
753                $self->{onerror}->(node => $node, type => 'element not allowed');
754              }
755            my ($sib, $ch) = $self->_check_get_children ($node, $todo);            my ($sib, $ch) = $self->_check_get_children ($node, $todo);
756            unshift @nodes, @$sib;            unshift @nodes, @$sib;
757            push @$new_todos, @$ch;            push @$new_todos, @$ch;
# Line 750  $Element->{$ATOM_NS}->{content} = { Line 776  $Element->{$ATOM_NS}->{content} = {
776                    
777          my $nt = $node->node_type;          my $nt = $node->node_type;
778          if ($nt == 1) {          if ($nt == 1) {
779            # MUST NOT            my $node_ns = $node->namespace_uri;
780            $self->{onerror}->(node => $node, type => 'element not allowed');            $node_ns = '' unless defined $node_ns;
781              my $node_ln = $node->manakai_local_name;
782              if ($self->{pluses}->{$node_ns}->{$node_ln}) {
783                #
784              } else {
785                # MUST NOT
786                $self->{onerror}->(node => $node, type => 'element not allowed');
787              }
788            my ($sib, $ch) = $self->_check_get_children ($node, $todo);            my ($sib, $ch) = $self->_check_get_children ($node, $todo);
789            unshift @nodes, @$sib;            unshift @nodes, @$sib;
790            push @$new_todos, @$ch;            push @$new_todos, @$ch;
# Line 783  $Element->{$ATOM_NS}->{content} = { Line 816  $Element->{$ATOM_NS}->{content} = {
816          if ($nt == 1) {          if ($nt == 1) {
817            # MUST            # MUST
818            my $nsuri = $node->namespace_uri;            my $nsuri = $node->namespace_uri;
819            if (defined $nsuri and            $nsuri = '' unless defined $nsuri;
820                $nsuri eq q<http://www.w3.org/1999/xhtml> and            my $node_ln = $node->manakai_local_name;
821                $node->manakai_local_name eq 'div' and            if ($self->{pluses}->{$nsuri}->{$node_ln}) {
822                not $has_div) {              #
823              } elsif ($nsuri eq q<http://www.w3.org/1999/xhtml> and
824                       $node_ln eq 'div' and not $has_div) {
825              ## TODO: SHOULD be suitable for handling as HTML [XHTML10]              ## TODO: SHOULD be suitable for handling as HTML [XHTML10]
826              $has_div = 1;              $has_div = 1;
827              $self->{onerror}->(node => $node, type => 'element not allowed')              $self->{onerror}->(node => $node, type => 'element not allowed')
# Line 825  $Element->{$ATOM_NS}->{content} = { Line 860  $Element->{$ATOM_NS}->{content} = {
860          my $nt = $node->node_type;          my $nt = $node->node_type;
861          if ($nt == 1) {          if ($nt == 1) {
862            ## MAY contain elements            ## MAY contain elements
863            $self->{onerror}->(node => $node, type => 'element not allowed')            if ($src_attr) {
864                if $src_attr;              my $node_ns = $node->namespace_uri;
865                $node_ns = '' unless defined $node_ns;
866                my $node_ln = $node->manakai_local_name;
867                if ($self->{pluses}->{$node_ns}->{$node_ln}) {
868                  #
869                } else {
870                  $self->{onerror}->(node => $node, type => 'element not allowed');
871                }
872              }
873            my ($sib, $ch) = $self->_check_get_children ($node, $todo);            my ($sib, $ch) = $self->_check_get_children ($node, $todo);
874            unshift @nodes, @$sib;            unshift @nodes, @$sib;
875            push @$new_todos, @$ch;            push @$new_todos, @$ch;
# Line 855  $Element->{$ATOM_NS}->{content} = { Line 898  $Element->{$ATOM_NS}->{content} = {
898                    
899          my $nt = $node->node_type;          my $nt = $node->node_type;
900          if ($nt == 1) {          if ($nt == 1) {
901            # MUST NOT            my $node_ns = $node->namespace_uri;
902            $self->{onerror}->(node => $node, type => 'element not allowed');            $node_ns = '' unless defined $node_ns;
903              my $node_ln = $node->manakai_local_name;
904              if ($self->{pluses}->{$node_ns}->{$node_ln}) {
905                #
906              } else {
907                # MUST NOT
908                $self->{onerror}->(node => $node, type => 'element not allowed');
909              }
910            my ($sib, $ch) = $self->_check_get_children ($node, $todo);            my ($sib, $ch) = $self->_check_get_children ($node, $todo);
911            unshift @nodes, @$sib;            unshift @nodes, @$sib;
912            push @$new_todos, @$ch;            push @$new_todos, @$ch;
# Line 912  $Element->{$ATOM_NS}->{content} = { Line 962  $Element->{$ATOM_NS}->{content} = {
962      }      }
963    },    },
964  };  };
965    ## TODO: Tests for <html:nest/> in <atom:content/>
966    
967  $Element->{$ATOM_NS}->{author} = $AtomPersonConstruct;  $Element->{$ATOM_NS}->{author} = $AtomPersonConstruct;
968    
# Line 963  $Element->{$ATOM_NS}->{category} = { Line 1014  $Element->{$ATOM_NS}->{category} = {
1014    
1015  $Element->{$ATOM_NS}->{contributor} = $AtomPersonConstruct;  $Element->{$ATOM_NS}->{contributor} = $AtomPersonConstruct;
1016    
1017    ## TODO: Anything below does not support <html:nest/> yet.
1018    
1019  $Element->{$ATOM_NS}->{generator} = {  $Element->{$ATOM_NS}->{generator} = {
1020    attrs_checker => $GetAtomAttrsChecker->({    attrs_checker => $GetAtomAttrsChecker->({
1021      uri => sub { # MUST      uri => sub { # MUST

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24