/[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.15 by wakaba, Thu Mar 20 09:38:47 2008 UTC revision 1.16 by wakaba, Thu Mar 20 10:30:21 2008 UTC
# Line 6  require Whatpm::URIChecker; Line 6  require Whatpm::URIChecker;
6    
7  my $ATOM_NS = q<http://www.w3.org/2005/Atom>;  my $ATOM_NS = q<http://www.w3.org/2005/Atom>;
8  my $THR_NS = q<http://purl.org/syndication/thread/1.0>;  my $THR_NS = q<http://purl.org/syndication/thread/1.0>;
9    my $FH_NS = q<http://purl.org/syndication/history/1.0>;
10  my $LINK_REL = q<http://www.iana.org/assignments/relation/>;  my $LINK_REL = q<http://www.iana.org/assignments/relation/>;
11    
12  sub FEATURE_RFC4287 () {  sub FEATURE_RFC4287 () {
# Line 450  $Element->{$ATOM_NS}->{entry} = { Line 451  $Element->{$ATOM_NS}->{entry} = {
451        ## ISSUE: Where |thr:in-reply-to| is allowed is not explicit;y        ## ISSUE: Where |thr:in-reply-to| is allowed is not explicit;y
452        ## defined in RFC 4685.        ## defined in RFC 4685.
453        #        #
454        } elsif ($child_nsuri eq $THR_NS and $child_ln eq 'total') {
455          #
456      } else {      } else {
457        ## TODO: extension element        ## TODO: extension element
458        $self->{onerror}->(node => $child_el, type => 'element not allowed');        $self->{onerror}->(node => $child_el, type => 'element not allowed');
# Line 1038  $Element->{$ATOM_NS}->{link} = { Line 1041  $Element->{$ATOM_NS}->{link} = {
1041        });        });
1042    
1043        ## TODO: Warn if unregistered        ## TODO: Warn if unregistered
1044    
1045          ## TODO: rel=license [RFC 4946]
1046          ## MUST NOT multiple rel=license with same href="",type="" pairs
1047          ## href="" SHOULD be dereferencable
1048          ## title="" SHOULD be there if multiple rel=license
1049          ## MUST NOT "unspecified" and other rel=license
1050      },      },
1051      title => sub { }, # No MUST      title => sub { }, # No MUST
1052      type => $AtomIMTAttrChecker,      type => $AtomIMTAttrChecker,
# Line 1049  $Element->{$ATOM_NS}->{link} = { Line 1058  $Element->{$ATOM_NS}->{link} = {
1058      rel => FEATURE_RFC4287,      rel => FEATURE_RFC4287,
1059      title => FEATURE_RFC4287,      title => FEATURE_RFC4287,
1060      type => FEATURE_RFC4287,      type => FEATURE_RFC4287,
1061    
1062        ## TODO: thr:count
1063        ## TODO: thr:updated
1064    }),    }),
1065    check_start =>  sub {    check_start =>  sub {
1066      my ($self, $item, $element_state) = @_;      my ($self, $item, $element_state) = @_;
# Line 1244  $Element->{$THR_NS}->{'in-reply-to'} = { Line 1256  $Element->{$THR_NS}->{'in-reply-to'} = {
1256    ## NOTE: Content model has no constraint.    ## NOTE: Content model has no constraint.
1257  };  };
1258    
1259    $Element->{$THR_NS}->{total} = {
1260      %AtomChecker,
1261      check_start =>  sub {
1262        my ($self, $item, $element_state) = @_;
1263        $element_state->{value} = '';
1264      },
1265      check_child_element => sub {
1266        my ($self, $item, $child_el, $child_nsuri, $child_ln,
1267            $child_is_transparent, $element_state) = @_;
1268    
1269        if ($self->{minus_elements}->{$child_nsuri}->{$child_ln}) {
1270          $self->{onerror}->(node => $child_el,
1271                             type => 'element not allowed:minus',
1272                             level => $self->{must_level});
1273        } elsif ($self->{plus_elements}->{$child_nsuri}->{$child_ln}) {
1274          #
1275        } else {
1276          $self->{onerror}->(node => $child_el,
1277                             type => 'element not allowed',
1278                             level => $self->{must_level});
1279        }
1280      },
1281      check_child_text => sub {
1282        my ($self, $item, $child_node, $has_significant, $element_state) = @_;
1283        $element_state->{value} .= $child_node->data;
1284      },
1285      check_end => sub {
1286        my ($self, $item, $element_state) = @_;
1287    
1288        ## NOTE: xsd:nonNegativeInteger
1289        unless ($element_state->{value} =~ /\A(?>[0-9]+|-0+)\z/) {
1290          $self->{onerror}->(node => $item->{node},
1291                             type => 'syntax error', ## TODO:
1292                             level => $self->{must_level});
1293        }
1294    
1295        $AtomChecker{check_end}->(@_);
1296      },
1297    };
1298    
1299    ## TODO: fh:complete
1300    
1301    ## TODO: fh:archive
1302    
1303    ## TODO: Check as archive document, page feed document, ...
1304    
1305    ## TODO: APP [RFC 5023]
1306    
1307  $Whatpm::ContentChecker::Namespace->{$ATOM_NS}->{loaded} = 1;  $Whatpm::ContentChecker::Namespace->{$ATOM_NS}->{loaded} = 1;
1308  $Whatpm::ContentChecker::Namespace->{$THR_NS}->{loaded} = 1;  $Whatpm::ContentChecker::Namespace->{$THR_NS}->{loaded} = 1;
1309    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24