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

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

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

revision 1.69 by wakaba, Tue Feb 26 07:46:22 2008 UTC revision 1.70 by wakaba, Tue Feb 26 08:28:00 2008 UTC
# Line 9  require Whatpm::URIChecker; Line 9  require Whatpm::URIChecker;
9    
10  ## TODO: Conformance of an HTML document with non-html root element.  ## TODO: Conformance of an HTML document with non-html root element.
11    
12    ## Stability
13  sub FEATURE_STATUS_REC () { 0b1 } ## Interoperable standard  sub FEATURE_STATUS_REC () { 0b1 } ## Interoperable standard
14  sub FEATURE_STATUS_CR () { 0b10 } ## Call for implementation  sub FEATURE_STATUS_CR () { 0b10 } ## Call for implementation
15  sub FEATURE_STATUS_LC () { 0b100 } ## Last call for comments  sub FEATURE_STATUS_LC () { 0b100 } ## Last call for comments
16  sub FEATURE_STATUS_WD () { 0b1000 } ## Working or editor's draft  sub FEATURE_STATUS_WD () { 0b1000 } ## Working or editor's draft
17    
18    ## Deprecated
19    sub FEATURE_DEPRECATED_SHOULD () { 0b100000 } ## SHOULD-level
20    sub FEATURE_DEPRECATED_INFO () { 0b1000000 } ## Does not affect conformance
21    
22    ## Conformance
23    sub FEATURE_ALLOWED () { 0b10000 }
24    
25  my $HTML_NS = q<http://www.w3.org/1999/xhtml>;  my $HTML_NS = q<http://www.w3.org/1999/xhtml>;
26  my $XML_NS = q<http://www.w3.org/XML/1998/namespace>;  my $XML_NS = q<http://www.w3.org/XML/1998/namespace>;
27  my $XMLNS_NS = q<http://www.w3.org/2000/xmlns/>;  my $XMLNS_NS = q<http://www.w3.org/2000/xmlns/>;
# Line 187  our %AnyChecker = ( Line 195  our %AnyChecker = (
195    
196  our $ElementDefault = {  our $ElementDefault = {
197    %AnyChecker,    %AnyChecker,
198      status => FEATURE_ALLOWED,
199          ## NOTE: No "element not defined" error - it is not supported anyway.
200    check_start => sub {    check_start => sub {
201      my ($self, $item, $element_state) = @_;      my ($self, $item, $element_state) = @_;
202      $self->{onerror}->(node => $item->{node}, level => 'unsupported',      $self->{onerror}->(node => $item->{node}, level => 'unsupported',
# Line 404  next unless $code;## TODO: temp. Line 414  next unless $code;## TODO: temp.
414                             type => 'status:'.$status.':element',                             type => 'status:'.$status.':element',
415                             level => $self->{info_level});                             level => $self->{info_level});
416        }        }
417          if (not ($eldef->{status} & FEATURE_ALLOWED)) {
418            $self->{onerror}->(node => $item->{node},
419                               type => 'element not defined',
420                               level => $self->{must_level});
421          } elsif ($eldef->{status} & FEATURE_DEPRECATED_SHOULD) {
422            $self->{onerror}->(node => $item->{node},
423                               type => 'deprecated:element',
424                               level => $self->{should_level});
425          } elsif ($eldef->{status} & FEATURE_DEPRECATED_INFO) {
426            $self->{onerror}->(node => $item->{node},
427                               type => 'deprecated:element',
428                               level => $self->{info_level});
429          }
430    
431        my @new_item;        my @new_item;
432        push @new_item, [$eldef->{check_start}, $self, $item, $element_state];        push @new_item, [$eldef->{check_start}, $self, $item, $element_state];
# Line 568  sub _remove_plus_elements ($$) { Line 591  sub _remove_plus_elements ($$) {
591    
592  sub _attr_status_info ($$$) {  sub _attr_status_info ($$$) {
593    my ($self, $attr, $status_code) = @_;    my ($self, $attr, $status_code) = @_;
594    
595      if (not ($status_code & FEATURE_ALLOWED)) {
596        $self->{onerror}->(node => $attr,
597                           type => 'attribute not defined',
598                           level => $self->{must_level});
599      } elsif ($status_code & FEATURE_DEPRECATED_SHOULD) {
600        $self->{onerror}->(node => $attr,
601                           type => 'deprecated:attr',
602                           level => $self->{should_level});
603      } elsif ($status_code & FEATURE_DEPRECATED_INFO) {
604        $self->{onerror}->(node => $attr,
605                           type => 'deprecated:attr',
606                           level => $self->{info_level});
607      }
608    
609    my $status;    my $status;
610    if ($status_code & FEATURE_STATUS_REC) {    if ($status_code & FEATURE_STATUS_REC) {
611      return;      return;

Legend:
Removed from v.1.69  
changed lines
  Added in v.1.70

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24