/[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.3 by wakaba, Sun May 13 05:35:22 2007 UTC revision 1.4 by wakaba, Sun May 13 08:09:15 2007 UTC
# Line 3  use strict; Line 3  use strict;
3    
4  ## ANY  ## ANY
5  my $AnyChecker = sub {  my $AnyChecker = sub {
6    my ($self, $el) = @_;    my ($self, $todo) = @_;
7    my $children = [];    my $el = $todo->{node};
8      my $new_todos = [];
9    my @nodes = (@{$el->child_nodes});    my @nodes = (@{$el->child_nodes});
10    while (@nodes) {    while (@nodes) {
11      my $node = shift @nodes;      my $node = shift @nodes;
# Line 18  my $AnyChecker = sub { Line 19  my $AnyChecker = sub {
19        if ($self->{minuses}->{$node_ns}->{$node_ln}) {        if ($self->{minuses}->{$node_ns}->{$node_ln}) {
20          $self->{onerror}->(node => $node, type => 'element not allowed');          $self->{onerror}->(node => $node, type => 'element not allowed');
21        }        }
22        push @$children, $node;        push @$new_todos, {type => 'element', node => $node};
23      } elsif ($nt == 5) {      } elsif ($nt == 5) {
24        unshift @nodes, @{$node->child_nodes};        unshift @nodes, @{$node->child_nodes};
25      }      }
26    }    }
27    return ($children);    return ($new_todos);
28  }; # $AnyChecker  }; # $AnyChecker
29    
30  my $ElementDefault = {  my $ElementDefault = {
31    checker => sub {    checker => sub {
32      my ($self, $el) = @_;      my ($self, $todo) = @_;
33      $self->{onerror}->(node => $el, type => 'element not supported');      $self->{onerror}->(node => $todo->{node}, type => 'element not supported');
34      return $AnyChecker->($self, $el);      return $AnyChecker->($self, $todo);
35    },    },
36  };  };
37    
# Line 170  my $HTMLEmbededElements = [ Line 171  my $HTMLEmbededElements = [
171    
172  ## Empty  ## Empty
173  my $HTMLEmptyChecker = sub {  my $HTMLEmptyChecker = sub {
174    my ($self, $el) = @_;    my ($self, $todo) = @_;
175    my $children = [];    my $el = $todo->{node};
176      my $new_todos = [];
177    my @nodes = (@{$el->child_nodes});    my @nodes = (@{$el->child_nodes});
178    
179    while (@nodes) {    while (@nodes) {
# Line 184  my $HTMLEmptyChecker = sub { Line 186  my $HTMLEmptyChecker = sub {
186        $self->{onerror}->(node => $node, type => 'element not allowed');        $self->{onerror}->(node => $node, type => 'element not allowed');
187        my ($sib, $ch) = $self->_check_get_children ($node);        my ($sib, $ch) = $self->_check_get_children ($node);
188        unshift @nodes, @$sib;        unshift @nodes, @$sib;
189        push @$children, @$ch;        push @$new_todos, @$ch;
190      } elsif ($nt == 3 or $nt == 4) {      } elsif ($nt == 3 or $nt == 4) {
191        if ($node->data =~ /[^\x09-\x0D\x20]/) {        if ($node->data =~ /[^\x09-\x0D\x20]/) {
192          $self->{onerror}->(node => $node, type => 'character not allowed');          $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 193  my $HTMLEmptyChecker = sub { Line 195  my $HTMLEmptyChecker = sub {
195        unshift @nodes, @{$node->child_nodes};        unshift @nodes, @{$node->child_nodes};
196      }      }
197    }    }
198    return ($children);    return ($new_todos);
199  };  };
200    
201  ## Text  ## Text
202  my $HTMLTextChecker = sub {  my $HTMLTextChecker = sub {
203    my ($self, $el) = @_;    my ($self, $todo) = @_;
204    my $children = [];    my $el = $todo->{node};
205      my $new_todos = [];
206    my @nodes = (@{$el->child_nodes});    my @nodes = (@{$el->child_nodes});
207    
208    while (@nodes) {    while (@nodes) {
# Line 212  my $HTMLTextChecker = sub { Line 215  my $HTMLTextChecker = sub {
215        $self->{onerror}->(node => $node, type => 'element not allowed');        $self->{onerror}->(node => $node, type => 'element not allowed');
216        my ($sib, $ch) = $self->_check_get_children ($node);        my ($sib, $ch) = $self->_check_get_children ($node);
217        unshift @nodes, @$sib;        unshift @nodes, @$sib;
218        push @$children, @$ch;        push @$new_todos, @$ch;
219      } elsif ($nt == 5) {      } elsif ($nt == 5) {
220        unshift @nodes, @{$node->child_nodes};        unshift @nodes, @{$node->child_nodes};
221      }      }
222    }    }
223    return ($children);    return ($new_todos);
224  };  };
225    
226  ## Zero or more |html:style| elements,  ## Zero or more |html:style| elements,
227  ## followed by zero or more block-level elements  ## followed by zero or more block-level elements
228  my $HTMLStylableBlockChecker = sub {  my $HTMLStylableBlockChecker = sub {
229    my ($self, $el) = @_;    my ($self, $todo) = @_;
230    my $children = [];    my $el = $todo->{node};
231      my $new_todos = [];
232    my @nodes = (@{$el->child_nodes});    my @nodes = (@{$el->child_nodes});
233        
234    my $has_non_style;    my $has_non_style;
# Line 257  my $HTMLStylableBlockChecker = sub { Line 261  my $HTMLStylableBlockChecker = sub {
261        }        }
262        my ($sib, $ch) = $self->_check_get_children ($node);        my ($sib, $ch) = $self->_check_get_children ($node);
263        unshift @nodes, @$sib;        unshift @nodes, @$sib;
264        push @$children, @$ch;        push @$new_todos, @$ch;
265      } elsif ($nt == 3 or $nt == 4) {      } elsif ($nt == 3 or $nt == 4) {
266        if ($node->data =~ /[^\x09-\x0D\x20]/) {        if ($node->data =~ /[^\x09-\x0D\x20]/) {
267          $self->{onerror}->(node => $node, type => 'character not allowed');          $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 266  my $HTMLStylableBlockChecker = sub { Line 270  my $HTMLStylableBlockChecker = sub {
270        unshift @nodes, @{$node->child_nodes};        unshift @nodes, @{$node->child_nodes};
271      }      }
272    }    }
273    return ($children);    return ($new_todos);
274  }; # $HTMLStylableBlockChecker  }; # $HTMLStylableBlockChecker
275    
276  ## Zero or more block-level elements  ## Zero or more block-level elements
277  my $HTMLBlockChecker = sub {  my $HTMLBlockChecker = sub {
278    my ($self, $el) = @_;    my ($self, $todo) = @_;
279    my $children = [];    my $el = $todo->{node};
280      my $new_todos = [];
281    my @nodes = (@{$el->child_nodes});    my @nodes = (@{$el->child_nodes});
282        
283    while (@nodes) {    while (@nodes) {
# Line 297  my $HTMLBlockChecker = sub { Line 302  my $HTMLBlockChecker = sub {
302        } # CHK        } # CHK
303        my ($sib, $ch) = $self->_check_get_children ($node);        my ($sib, $ch) = $self->_check_get_children ($node);
304        unshift @nodes, @$sib;        unshift @nodes, @$sib;
305        push @$children, @$ch;        push @$new_todos, @$ch;
306      } elsif ($nt == 3 or $nt == 4) {      } elsif ($nt == 3 or $nt == 4) {
307        if ($node->data =~ /[^\x09-\x0D\x20]/) {        if ($node->data =~ /[^\x09-\x0D\x20]/) {
308          $self->{onerror}->(node => $node, type => 'character not allowed');          $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 306  my $HTMLBlockChecker = sub { Line 311  my $HTMLBlockChecker = sub {
311        unshift @nodes, @{$node->child_nodes};        unshift @nodes, @{$node->child_nodes};
312      }      }
313    }    }
314    return ($children);    return ($new_todos);
315  }; # $HTMLBlockChecker  }; # $HTMLBlockChecker
316    
317  ## Inline-level content  ## Inline-level content
318  my $HTMLInlineChecker = sub {  my $HTMLInlineChecker = sub {
319    my ($self, $el) = @_;    my ($self, $todo) = @_;
320    my $children = [];    my $el = $todo->{node};
321      my $new_todos = [];
322    my @nodes = (@{$el->child_nodes});    my @nodes = (@{$el->child_nodes});
323        
324    while (@nodes) {    while (@nodes) {
# Line 338  my $HTMLInlineChecker = sub { Line 344  my $HTMLInlineChecker = sub {
344        } # CHK        } # CHK
345        my ($sib, $ch) = $self->_check_get_children ($node);        my ($sib, $ch) = $self->_check_get_children ($node);
346        unshift @nodes, @$sib;        unshift @nodes, @$sib;
347        push @$children, @$ch;        push @$new_todos, @$ch;
348      } elsif ($nt == 5) {      } elsif ($nt == 5) {
349        unshift @nodes, @{$node->child_nodes};        unshift @nodes, @{$node->child_nodes};
350      }      }
351    }    }
352    return ($children);  
353  }; # $HTMLStrictlyInlineChecker    for (@$new_todos) {
354        $_->{inline} = 1;
355      }
356      return ($new_todos);
357    }; # $HTMLInlineChecker
358    
359  my $HTMLSignificantInlineChecker = $HTMLInlineChecker;  my $HTMLSignificantInlineChecker = $HTMLInlineChecker;
360  ## TODO: check significant content  ## TODO: check significant content
361    
362  ## Strictly inline-level content  ## Strictly inline-level content
363  my $HTMLStrictlyInlineChecker = sub {  my $HTMLStrictlyInlineChecker = sub {
364    my ($self, $el) = @_;    my ($self, $todo) = @_;
365    my $children = [];    my $el = $todo->{node};
366      my $new_todos = [];
367    my @nodes = (@{$el->child_nodes});    my @nodes = (@{$el->child_nodes});
368        
369    while (@nodes) {    while (@nodes) {
# Line 377  my $HTMLStrictlyInlineChecker = sub { Line 388  my $HTMLStrictlyInlineChecker = sub {
388        } # CHK        } # CHK
389        my ($sib, $ch) = $self->_check_get_children ($node);        my ($sib, $ch) = $self->_check_get_children ($node);
390        unshift @nodes, @$sib;        unshift @nodes, @$sib;
391        push @$children, @$ch;        push @$new_todos, @$ch;
392      } elsif ($nt == 5) {      } elsif ($nt == 5) {
393        unshift @nodes, @{$node->child_nodes};        unshift @nodes, @{$node->child_nodes};
394      }      }
395    }    }
396    return ($children);  
397      for (@$new_todos) {
398        $_->{inline} = 1;
399        $_->{strictly_inline} = 1;
400      }
401      return ($new_todos);
402  }; # $HTMLStrictlyInlineChecker  }; # $HTMLStrictlyInlineChecker
403    
404  my $HTMLSignificantStrictlyInlineChecker = $HTMLStrictlyInlineChecker;  my $HTMLSignificantStrictlyInlineChecker = $HTMLStrictlyInlineChecker;
405  ## TODO: check significant content  ## TODO: check significant content
406    
407    ## Inline-level or strictly inline-kevek content
408    my $HTMLInlineOrStrictlyInlineChecker = sub {
409      my ($self, $todo) = @_;
410      my $el = $todo->{node};
411      my $new_todos = [];
412      my @nodes = (@{$el->child_nodes});
413      
414      while (@nodes) {
415        my $node = shift @nodes;
416        $self->_remove_minuses ($node) and next if ref $node eq 'HASH';
417    
418        my $nt = $node->node_type;
419        if ($nt == 1) {
420          my $node_ns = $node->namespace_uri;
421          $node_ns = '' unless defined $node_ns;
422          my $node_ln = $node->manakai_local_name;
423          if ($self->{minuses}->{$node_ns}->{$node_ln}) {
424            $self->{onerror}->(node => $node, type => 'element not allowed');
425          }
426          CHK: {
427            for (@{$HTMLStrictlyInlineLevelElements},
428                 $todo->{strictly_inline} ? () : @{$HTMLStructuredInlineLevelElements}) {
429              if ($node->manakai_element_type_match ($_->[0], $_->[1])) {
430                last CHK;
431              }
432            }
433            $self->{onerror}->(node => $node, type => 'element not allowed');
434          } # CHK
435          my ($sib, $ch) = $self->_check_get_children ($node);
436          unshift @nodes, @$sib;
437          push @$new_todos, @$ch;
438        } elsif ($nt == 5) {
439          unshift @nodes, @{$node->child_nodes};
440        }
441      }
442    
443      for (@$new_todos) {
444        $_->{inline} = 1;
445        $_->{strictly_inline} = 1;
446      }
447      return ($new_todos);
448    }; # $HTMLInlineOrStrictlyInlineChecker
449    
450  my $HTMLBlockOrInlineChecker = sub {  my $HTMLBlockOrInlineChecker = sub {
451    my ($self, $el) = @_;    my ($self, $todo) = @_;
452    my $children = [];    my $el = $todo->{node};
453      my $new_todos = [];
454    my @nodes = (@{$el->child_nodes});    my @nodes = (@{$el->child_nodes});
455        
456    my $content = 'block-or-inline'; # or 'block' or 'inline'    my $content = 'block-or-inline'; # or 'block' or 'inline'
# Line 457  my $HTMLBlockOrInlineChecker = sub { Line 517  my $HTMLBlockOrInlineChecker = sub {
517        }        }
518        my ($sib, $ch) = $self->_check_get_children ($node);        my ($sib, $ch) = $self->_check_get_children ($node);
519        unshift @nodes, @$sib;        unshift @nodes, @$sib;
520        push @$children, @$ch;        push @$new_todos, @$ch;
521      } elsif ($nt == 3 or $nt == 4) {      } elsif ($nt == 3 or $nt == 4) {
522        if ($node->data =~ /[^\x09-\x0D\x20]/) {        if ($node->data =~ /[^\x09-\x0D\x20]/) {
523          if ($content eq 'block') {          if ($content eq 'block') {
# Line 473  my $HTMLBlockOrInlineChecker = sub { Line 533  my $HTMLBlockOrInlineChecker = sub {
533        unshift @nodes, @{$node->child_nodes};        unshift @nodes, @{$node->child_nodes};
534      }      }
535    }    }
536    return ($children);  
537      if ($content eq 'inline') {
538        for (@$new_todos) {
539          $_->{inline} = 1;
540        }
541      }
542      return ($new_todos);
543  };  };
544    
545  ## Zero or more XXX element, then either block-level or inline-level  ## Zero or more XXX element, then either block-level or inline-level
546  my $GetHTMLZeroOrMoreThenBlockOrInlineChecker = sub ($$) {  my $GetHTMLZeroOrMoreThenBlockOrInlineChecker = sub ($$) {
547    my ($elnsuri, $ellname) = @_;    my ($elnsuri, $ellname) = @_;
548    return sub {    return sub {
549      my ($self, $el) = @_;      my ($self, $todo) = @_;
550      my $children = [];      my $el = $todo->{node};
551        my $new_todos = [];
552      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
553            
554      my $has_non_style;      my $has_non_style;
# Line 556  my $GetHTMLZeroOrMoreThenBlockOrInlineCh Line 623  my $GetHTMLZeroOrMoreThenBlockOrInlineCh
623          }          }
624          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
625          unshift @nodes, @$sib;          unshift @nodes, @$sib;
626          push @$children, @$ch;          push @$new_todos, @$ch;
627        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
628          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
629            $has_non_style = 1;            $has_non_style = 1;
# Line 573  my $GetHTMLZeroOrMoreThenBlockOrInlineCh Line 640  my $GetHTMLZeroOrMoreThenBlockOrInlineCh
640          unshift @nodes, @{$node->child_nodes};          unshift @nodes, @{$node->child_nodes};
641        }        }
642      }      }
643      return ($children);  
644        if ($content eq 'inline') {
645          for (@$new_todos) {
646            $_->{inline} = 1;
647          }
648        }
649        return ($new_todos);
650    };    };
651  }; # $GetHTMLZeroOrMoreThenBlockOrInlineChecker  }; # $GetHTMLZeroOrMoreThenBlockOrInlineChecker
652    
# Line 581  my $HTMLTransparentChecker = $HTMLBlockO Line 654  my $HTMLTransparentChecker = $HTMLBlockO
654    
655  $Element->{$HTML_NS}->{html} = {  $Element->{$HTML_NS}->{html} = {
656    checker => sub {    checker => sub {
657      my ($self, $el) = @_;      my ($self, $todo) = @_;
658      my $children = [];      my $el = $todo->{node};
659        my $new_todos = [];
660      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
661    
662      my $phase = 'before head';      my $phase = 'before head';
# Line 622  $Element->{$HTML_NS}->{html} = { Line 696  $Element->{$HTML_NS}->{html} = {
696          }          }
697          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
698          unshift @nodes, @$sib;          unshift @nodes, @$sib;
699          push @$children, @$ch;          push @$new_todos, @$ch;
700        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
701          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
702            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 639  $Element->{$HTML_NS}->{html} = { Line 713  $Element->{$HTML_NS}->{html} = {
713        $self->{onerror}->(node => $el, type => 'child element missing:body');        $self->{onerror}->(node => $el, type => 'child element missing:body');
714      }      }
715    
716      return ($children);      return ($new_todos);
717    },    },
718  };  };
719    
720  $Element->{$HTML_NS}->{head} = {  $Element->{$HTML_NS}->{head} = {
721    checker => sub {    checker => sub {
722      my ($self, $el) = @_;      my ($self, $todo) = @_;
723      my $children = [];      my $el = $todo->{node};
724        my $new_todos = [];
725      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
726    
727      my $has_title;      my $has_title;
# Line 700  $Element->{$HTML_NS}->{head} = { Line 775  $Element->{$HTML_NS}->{head} = {
775          }          }
776          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
777          unshift @nodes, @$sib;          unshift @nodes, @$sib;
778          push @$children, @$ch;          push @$new_todos, @$ch;
779        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
780          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
781            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 712  $Element->{$HTML_NS}->{head} = { Line 787  $Element->{$HTML_NS}->{head} = {
787      unless ($has_title) {      unless ($has_title) {
788        $self->{onerror}->(node => $el, type => 'child element missing:title');        $self->{onerror}->(node => $el, type => 'child element missing:title');
789      }      }
790      return ($children);      return ($new_todos);
791    },    },
792  };  };
793    
# Line 789  $Element->{$HTML_NS}->{h6} = { Line 864  $Element->{$HTML_NS}->{h6} = {
864    
865  $Element->{$HTML_NS}->{footer} = {  $Element->{$HTML_NS}->{footer} = {
866    checker => sub { ## block -hn -header -footer -sectioning or inline    checker => sub { ## block -hn -header -footer -sectioning or inline
867      my ($self, $el) = @_;      my ($self, $todo) = @_;
868      my $children = [];      my $el = $todo->{node};
869        my $new_todos = [];
870      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
871        
872      my $content = 'block-or-inline'; # or 'block' or 'inline'      my $content = 'block-or-inline'; # or 'block' or 'inline'
# Line 864  $Element->{$HTML_NS}->{footer} = { Line 940  $Element->{$HTML_NS}->{footer} = {
940          }          }
941          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
942          unshift @nodes, @$sib;          unshift @nodes, @$sib;
943          push @$children, @$ch;          push @$new_todos, @$ch;
944        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
945          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
946            if ($content eq 'block') {            if ($content eq 'block') {
# Line 884  $Element->{$HTML_NS}->{footer} = { Line 960  $Element->{$HTML_NS}->{footer} = {
960      my $end = $self->_add_minuses      my $end = $self->_add_minuses
961        ({$HTML_NS => {qw/h1 1 h2 1 h3 1 h4 1 h5 1 h6 1/}},        ({$HTML_NS => {qw/h1 1 h2 1 h3 1 h4 1 h5 1 h6 1/}},
962         $HTMLSectioningElements);         $HTMLSectioningElements);
963      push @$children, $end;      push @$new_todos, $end;
964    
965      return ($children);      if ($content eq 'inline') {
966          for (@$new_todos) {
967            $_->{inline} = 1;
968          }
969        }
970    
971        return ($new_todos);
972    },    },
973  };  };
974    
# Line 908  $Element->{$HTML_NS}->{br} = { Line 990  $Element->{$HTML_NS}->{br} = {
990    
991  $Element->{$HTML_NS}->{dialog} = {  $Element->{$HTML_NS}->{dialog} = {
992    checker => sub {    checker => sub {
993      my ($self, $el) = @_;      my ($self, $todo) = @_;
994      my $children = [];      my $el = $todo->{node};
995        my $new_todos = [];
996      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
997    
998      my $phase = 'before dt';      my $phase = 'before dt';
# Line 943  $Element->{$HTML_NS}->{dialog} = { Line 1026  $Element->{$HTML_NS}->{dialog} = {
1026          }          }
1027          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
1028          unshift @nodes, @$sib;          unshift @nodes, @$sib;
1029          push @$children, @$ch;          push @$new_todos, @$ch;
1030        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
1031          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
1032            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 955  $Element->{$HTML_NS}->{dialog} = { Line 1038  $Element->{$HTML_NS}->{dialog} = {
1038      if ($phase eq 'before dd') {      if ($phase eq 'before dd') {
1039        $self->{onerror}->(node => $el, type => 'ps element missing:dd');        $self->{onerror}->(node => $el, type => 'ps element missing:dd');
1040      }      }
1041      return ($children);      return ($new_todos);
1042    },    },
1043  };  };
1044    
# Line 965  $Element->{$HTML_NS}->{pre} = { Line 1048  $Element->{$HTML_NS}->{pre} = {
1048    
1049  $Element->{$HTML_NS}->{ol} = {  $Element->{$HTML_NS}->{ol} = {
1050    checker => sub {    checker => sub {
1051      my ($self, $el) = @_;      my ($self, $todo) = @_;
1052      my $children = [];      my $el = $todo->{node};
1053        my $new_todos = [];
1054      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
1055    
1056      while (@nodes) {      while (@nodes) {
# Line 981  $Element->{$HTML_NS}->{ol} = { Line 1065  $Element->{$HTML_NS}->{ol} = {
1065          }          }
1066          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
1067          unshift @nodes, @$sib;          unshift @nodes, @$sib;
1068          push @$children, @$ch;          push @$new_todos, @$ch;
1069        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
1070          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
1071            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 990  $Element->{$HTML_NS}->{ol} = { Line 1074  $Element->{$HTML_NS}->{ol} = {
1074          unshift @nodes, @{$node->child_nodes};          unshift @nodes, @{$node->child_nodes};
1075        }        }
1076      }      }
1077      return ($children);  
1078        if ($todo->{inline}) {
1079          for (@$new_todos) {
1080            $_->{inline} = 1;
1081          }
1082        }
1083        return ($new_todos);
1084    },    },
1085  };  };
1086    
# Line 1002  $Element->{$HTML_NS}->{ul} = { Line 1092  $Element->{$HTML_NS}->{ul} = {
1092    
1093  $Element->{$HTML_NS}->{dl} = {  $Element->{$HTML_NS}->{dl} = {
1094    checker => sub {    checker => sub {
1095      my ($self, $el) = @_;      my ($self, $todo) = @_;
1096      my $children = [];      my $el = $todo->{node};
1097        my $new_todos = [];
1098      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
1099    
1100      my $phase = 'before dt';      my $phase = 'before dt';
# Line 1043  $Element->{$HTML_NS}->{dl} = { Line 1134  $Element->{$HTML_NS}->{dl} = {
1134          }          }
1135          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
1136          unshift @nodes, @$sib;          unshift @nodes, @$sib;
1137          push @$children, @$ch;          push @$new_todos, @$ch;
1138        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
1139          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
1140            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 1055  $Element->{$HTML_NS}->{dl} = { Line 1146  $Element->{$HTML_NS}->{dl} = {
1146      if ($phase eq 'in dts') {      if ($phase eq 'in dts') {
1147        $self->{onerror}->(node => $el, type => 'ps element missing:dd');        $self->{onerror}->(node => $el, type => 'ps element missing:dd');
1148      }      }
1149      return ($children);  
1150        if ($todo->{inline}) {
1151          for (@$new_todos) {
1152            $_->{inline} = 1;
1153          }
1154        }
1155        return ($new_todos);
1156    },    },
1157  };  };
1158    
# Line 1063  $Element->{$HTML_NS}->{dt} = { Line 1160  $Element->{$HTML_NS}->{dt} = {
1160    checker => $HTMLStrictlyInlineChecker,    checker => $HTMLStrictlyInlineChecker,
1161  };  };
1162    
1163  ## TODO: dd  $Element->{$HTML_NS}->{dd} = {
1164      checker => sub {
1165        my ($self, $todo) = @_;
1166        if ($todo->{inline}) {
1167          return $HTMLInlineChecker->($self, $todo);
1168        } else {
1169          return $HTMLBlockOrInlineChecker->($self, $todo);
1170        }
1171      },
1172    };
1173    
1174  ## TODO: a  ## TODO: a
1175    
1176  ## TODO: q  $Element->{$HTML_NS}->{q} = {
1177      checker => $HTMLInlineOrStrictlyInlineChecker,
1178    };
1179    
1180  $Element->{$HTML_NS}->{cite} = {  $Element->{$HTML_NS}->{cite} = {
1181    checker => $HTMLStrictlyInlineChecker,    checker => $HTMLStrictlyInlineChecker,
1182  };  };
1183    
1184  ## TODO: em  $Element->{$HTML_NS}->{em} = {
1185      checker => $HTMLInlineOrStrictlyInlineChecker,
1186    };
1187    
1188    $Element->{$HTML_NS}->{strong} = {
1189      checker => $HTMLInlineOrStrictlyInlineChecker,
1190    };
1191    
1192  ## TODO: strong, small, m, dfn  $Element->{$HTML_NS}->{small} = {
1193      checker => $HTMLInlineOrStrictlyInlineChecker,
1194    };
1195    
1196    $Element->{$HTML_NS}->{m} = {
1197      checker => $HTMLInlineOrStrictlyInlineChecker,
1198    };
1199    
1200    $Element->{$HTML_NS}->{dfn} = {
1201      checker => sub {
1202        my ($self, $todo) = @_;
1203    
1204        my $end = $self->_add_minuses ({$HTML_NS => {dfn => 1}});
1205        my ($sib, $ch) = $HTMLStrictlyInlineChecker->($self, $todo);
1206        push @$sib, $end;
1207        return ($sib, $ch);
1208      },
1209    };
1210    
1211  $Element->{$HTML_NS}->{abbr} = {  $Element->{$HTML_NS}->{abbr} = {
1212    checker => $HTMLStrictlyInlineChecker,    checker => $HTMLStrictlyInlineChecker,
# Line 1093  $Element->{$HTML_NS}->{progress} = { Line 1224  $Element->{$HTML_NS}->{progress} = {
1224    checker => $HTMLStrictlyInlineChecker,    checker => $HTMLStrictlyInlineChecker,
1225  };  };
1226    
1227  ## TODO: code  $Element->{$HTML_NS}->{code} = {
1228      checker => $HTMLInlineOrStrictlyInlineChecker,
1229    };
1230    
1231  $Element->{$HTML_NS}->{var} = {  $Element->{$HTML_NS}->{var} = {
1232    checker => $HTMLStrictlyInlineChecker,    checker => $HTMLStrictlyInlineChecker,
1233  };  };
1234    
1235  ## TODO: samp  $Element->{$HTML_NS}->{samp} = {
1236      checker => $HTMLInlineOrStrictlyInlineChecker,
1237    };
1238    
1239  $Element->{$HTML_NS}->{kbd} = {  $Element->{$HTML_NS}->{kbd} = {
1240    checker => $HTMLStrictlyInlineChecker,    checker => $HTMLStrictlyInlineChecker,
# Line 1113  $Element->{$HTML_NS}->{sup} = { Line 1248  $Element->{$HTML_NS}->{sup} = {
1248    checker => $HTMLStrictlyInlineChecker,    checker => $HTMLStrictlyInlineChecker,
1249  };  };
1250    
1251  ## TODO: span  $Element->{$HTML_NS}->{span} = {
1252      checker => $HTMLInlineOrStrictlyInlineChecker,
1253    };
1254    
1255  $Element->{$HTML_NS}->{i} = {  $Element->{$HTML_NS}->{i} = {
1256    checker => $HTMLStrictlyInlineChecker,    checker => $HTMLStrictlyInlineChecker,
# Line 1133  $Element->{$HTML_NS}->{ins} = { Line 1270  $Element->{$HTML_NS}->{ins} = {
1270    
1271  $Element->{$HTML_NS}->{del} = {  $Element->{$HTML_NS}->{del} = {
1272    checker => sub {    checker => sub {
1273      my ($self, $el) = @_;      my ($self, $todo) = @_;
1274    
1275      my $parent = $el->manakai_parent_element;      my $parent = $todo->{node}->manakai_parent_element;
1276      if (defined $parent) {      if (defined $parent) {
1277        my $nsuri = $parent->namespace_uri;        my $nsuri = $parent->namespace_uri;
1278        $nsuri = '' unless defined $nsuri;        $nsuri = '' unless defined $nsuri;
# Line 1143  $Element->{$HTML_NS}->{del} = { Line 1280  $Element->{$HTML_NS}->{del} = {
1280        my $eldef = $Element->{$nsuri}->{$ln} ||        my $eldef = $Element->{$nsuri}->{$ln} ||
1281          $Element->{$nsuri}->{''} ||          $Element->{$nsuri}->{''} ||
1282          $ElementDefault;          $ElementDefault;
1283        return $eldef->{checker}->($self, $el);        return $eldef->{checker}->($self, $todo);
1284      } else {      } else {
1285        return $HTMLBlockOrInlineChecker->($self, $el);        return $HTMLBlockOrInlineChecker->($self, $todo);
1286      }      }
1287    },    },
1288  };  };
# Line 1172  $Element->{$HTML_NS}->{param} = { Line 1309  $Element->{$HTML_NS}->{param} = {
1309    
1310  $Element->{$HTML_NS}->{video} = {  $Element->{$HTML_NS}->{video} = {
1311    checker => sub {    checker => sub {
1312      my ($self, $el) = @_;      my ($self, $todo) = @_;
1313    
1314      if ($el->has_attribute_ns (undef, 'src')) {      if ($todo->{node}->has_attribute_ns (undef, 'src')) {
1315        return $HTMLBlockOrInlineChecker->($self, $el);        return $HTMLBlockOrInlineChecker->($self, $todo);
1316      } else {      } else {
1317        return $GetHTMLZeroOrMoreThenBlockOrInlineChecker->($HTML_NS, 'source')        return $GetHTMLZeroOrMoreThenBlockOrInlineChecker->($HTML_NS, 'source')
1318          ->($self, $el);          ->($self, $todo);
1319      }      }
1320    },    },
1321  };  };
# Line 1206  $Element->{$HTML_NS}->{area} = { Line 1343  $Element->{$HTML_NS}->{area} = {
1343    
1344  $Element->{$HTML_NS}->{table} = {  $Element->{$HTML_NS}->{table} = {
1345    checker => sub {    checker => sub {
1346      my ($self, $el) = @_;      my ($self, $todo) = @_;
1347      my $children = [];      my $el = $todo->{node};
1348        my $new_todos = [];
1349      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
1350    
1351      my $phase = 'before caption';      my $phase = 'before caption';
# Line 1287  $Element->{$HTML_NS}->{table} = { Line 1425  $Element->{$HTML_NS}->{table} = {
1425          }          }
1426          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
1427          unshift @nodes, @$sib;          unshift @nodes, @$sib;
1428          push @$children, @$ch;          push @$new_todos, @$ch;
1429        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
1430          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
1431            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 1296  $Element->{$HTML_NS}->{table} = { Line 1434  $Element->{$HTML_NS}->{table} = {
1434          unshift @nodes, @{$node->child_nodes};          unshift @nodes, @{$node->child_nodes};
1435        }        }
1436      }      }
1437      return ($children);      return ($new_todos);
1438    },    },
1439  };  };
1440    
# Line 1306  $Element->{$HTML_NS}->{caption} = { Line 1444  $Element->{$HTML_NS}->{caption} = {
1444    
1445  $Element->{$HTML_NS}->{colgroup} = {  $Element->{$HTML_NS}->{colgroup} = {
1446    checker => sub {    checker => sub {
1447      my ($self, $el) = @_;      my ($self, $todo) = @_;
1448      my $children = [];      my $el = $todo->{node};
1449        my $new_todos = [];
1450      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
1451    
1452      while (@nodes) {      while (@nodes) {
# Line 1322  $Element->{$HTML_NS}->{colgroup} = { Line 1461  $Element->{$HTML_NS}->{colgroup} = {
1461          }          }
1462          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
1463          unshift @nodes, @$sib;          unshift @nodes, @$sib;
1464          push @$children, @$ch;          push @$new_todos, @$ch;
1465        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
1466          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
1467            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 1331  $Element->{$HTML_NS}->{colgroup} = { Line 1470  $Element->{$HTML_NS}->{colgroup} = {
1470          unshift @nodes, @{$node->child_nodes};          unshift @nodes, @{$node->child_nodes};
1471        }        }
1472      }      }
1473      return ($children);      return ($new_todos);
1474    },    },
1475  };  };
1476    
# Line 1341  $Element->{$HTML_NS}->{col} = { Line 1480  $Element->{$HTML_NS}->{col} = {
1480    
1481  $Element->{$HTML_NS}->{tbody} = {  $Element->{$HTML_NS}->{tbody} = {
1482    checker => sub {    checker => sub {
1483      my ($self, $el) = @_;      my ($self, $todo) = @_;
1484      my $children = [];      my $el = $todo->{node};
1485        my $new_todos = [];
1486      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
1487    
1488      my $has_tr;      my $has_tr;
# Line 1360  $Element->{$HTML_NS}->{tbody} = { Line 1500  $Element->{$HTML_NS}->{tbody} = {
1500          }          }
1501          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
1502          unshift @nodes, @$sib;          unshift @nodes, @$sib;
1503          push @$children, @$ch;          push @$new_todos, @$ch;
1504        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
1505          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
1506            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 1372  $Element->{$HTML_NS}->{tbody} = { Line 1512  $Element->{$HTML_NS}->{tbody} = {
1512      unless ($has_tr) {      unless ($has_tr) {
1513        $self->{onerror}->(node => $el, type => 'child element missing:tr');        $self->{onerror}->(node => $el, type => 'child element missing:tr');
1514      }      }
1515      return ($children);      return ($new_todos);
1516    },    },
1517  };  };
1518    
# Line 1386  $Element->{$HTML_NS}->{tfoot} = { Line 1526  $Element->{$HTML_NS}->{tfoot} = {
1526    
1527  $Element->{$HTML_NS}->{tr} = {  $Element->{$HTML_NS}->{tr} = {
1528    checker => sub {    checker => sub {
1529      my ($self, $el) = @_;      my ($self, $todo) = @_;
1530      my $children = [];      my $el = $todo->{node};
1531        my $new_todos = [];
1532      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
1533    
1534      my $has_td;      my $has_td;
# Line 1406  $Element->{$HTML_NS}->{tr} = { Line 1547  $Element->{$HTML_NS}->{tr} = {
1547          }          }
1548          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
1549          unshift @nodes, @$sib;          unshift @nodes, @$sib;
1550          push @$children, @$ch;          push @$new_todos, @$ch;
1551        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
1552          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
1553            $self->{onerror}->(node => $node, type => 'character not allowed');            $self->{onerror}->(node => $node, type => 'character not allowed');
# Line 1418  $Element->{$HTML_NS}->{tr} = { Line 1559  $Element->{$HTML_NS}->{tr} = {
1559      unless ($has_td) {      unless ($has_td) {
1560        $self->{onerror}->(node => $el, type => 'child element missing:td|th');        $self->{onerror}->(node => $el, type => 'child element missing:td|th');
1561      }      }
1562      return ($children);      return ($new_todos);
1563    },    },
1564  };  };
1565    
# Line 1434  $Element->{$HTML_NS}->{th} = { Line 1575  $Element->{$HTML_NS}->{th} = {
1575    
1576  $Element->{$HTML_NS}->{script} = {  $Element->{$HTML_NS}->{script} = {
1577    checker => sub {    checker => sub {
1578      my ($self, $el) = @_;      my ($self, $todo) = @_;
1579    
1580      if ($el->has_attribute_ns (undef, 'src')) {      if ($todo->{node}->has_attribute_ns (undef, 'src')) {
1581        return $HTMLEmptyChecker->($self, $el);        return $HTMLEmptyChecker->($self, $todo);
1582      } else {      } else {
1583        ## NOTE: No content model conformance in HTML5 spec.        ## NOTE: No content model conformance in HTML5 spec.
1584        return $AnyChecker->($self, $el);        return $AnyChecker->($self, $todo);
1585      }      }
1586    },    },
1587  };  };
# Line 1448  $Element->{$HTML_NS}->{script} = { Line 1589  $Element->{$HTML_NS}->{script} = {
1589  ## NOTE: When script is disabled.  ## NOTE: When script is disabled.
1590  $Element->{$HTML_NS}->{noscript} = {  $Element->{$HTML_NS}->{noscript} = {
1591    checker => sub {    checker => sub {
1592      my ($self, $el) = @_;      my ($self, $todo) = @_;
1593    
1594      my $end = $self->_add_minuses ({$HTML_NS => {noscript => 1}});      my $end = $self->_add_minuses ({$HTML_NS => {noscript => 1}});
1595      my ($sib, $ch) = $HTMLBlockOrInlineChecker->($self, $el);      my ($sib, $ch) = $HTMLBlockOrInlineChecker->($self, $todo);
1596      push @$sib, $end;      push @$sib, $end;
1597      return ($sib, $ch);      return ($sib, $ch);
1598    },    },
1599  };  };
 ## TODO: noscript  
1600    
1601  $Element->{$HTML_NS}->{'event-source'} = {  $Element->{$HTML_NS}->{'event-source'} = {
1602    checker => $HTMLEmptyChecker,    checker => $HTMLEmptyChecker,
# Line 1476  $Element->{$HTML_NS}->{command} = { Line 1616  $Element->{$HTML_NS}->{command} = {
1616    
1617  $Element->{$HTML_NS}->{menu} = {  $Element->{$HTML_NS}->{menu} = {
1618    checker => sub {    checker => sub {
1619      my ($self, $el) = @_;      my ($self, $todo) = @_;
1620      my $children = [];      my $el = $todo->{node};
1621        my $new_todos = [];
1622      my @nodes = (@{$el->child_nodes});      my @nodes = (@{$el->child_nodes});
1623            
1624      my $content = 'li or inline';      my $content = 'li or inline';
# Line 1513  $Element->{$HTML_NS}->{menu} = { Line 1654  $Element->{$HTML_NS}->{menu} = {
1654          }          }
1655          my ($sib, $ch) = $self->_check_get_children ($node);          my ($sib, $ch) = $self->_check_get_children ($node);
1656          unshift @nodes, @$sib;          unshift @nodes, @$sib;
1657          push @$children, @$ch;          push @$new_todos, @$ch;
1658        } elsif ($nt == 3 or $nt == 4) {        } elsif ($nt == 3 or $nt == 4) {
1659          if ($node->data =~ /[^\x09-\x0D\x20]/) {          if ($node->data =~ /[^\x09-\x0D\x20]/) {
1660            if ($content eq 'li') {            if ($content eq 'li') {
# Line 1526  $Element->{$HTML_NS}->{menu} = { Line 1667  $Element->{$HTML_NS}->{menu} = {
1667          unshift @nodes, @{$node->child_nodes};          unshift @nodes, @{$node->child_nodes};
1668        }        }
1669      }      }
1670      return ($children);  
1671        for (@$new_todos) {
1672          $_->{inline} = 1;
1673        }
1674        return ($new_todos);
1675    },    },
1676  };  };
1677    
# Line 1554  sub check_element ($$$) { Line 1699  sub check_element ($$$) {
1699    $self->{minuses} = {};    $self->{minuses} = {};
1700    $self->{onerror} = $onerror;    $self->{onerror} = $onerror;
1701    
1702    my @nodes = ($el);    my @todo = ({type => 'element', node => $el});
1703    while (@nodes) {    while (@todo) {
1704      my $node = shift @nodes;      my $todo = shift @todo;
1705      $self->_remove_minuses ($node) and next if ref $node eq 'HASH';      if ($todo->{type} eq 'element') {
1706          my $nsuri = $todo->{node}->namespace_uri;
1707      my $nsuri = $node->namespace_uri;        $nsuri = '' unless defined $nsuri;
1708      $nsuri = '' unless defined $nsuri;        my $ln = $todo->{node}->manakai_local_name;
1709      my $ln = $node->manakai_local_name;        my $eldef = $Element->{$nsuri}->{$ln} ||
1710      my $eldef = $Element->{$nsuri}->{$ln} ||          $Element->{$nsuri}->{''} ||
1711        $Element->{$nsuri}->{''} ||            $ElementDefault;
1712        $ElementDefault;        my ($new_todos) = $eldef->{checker}->($self, $todo);
1713      my ($children) = $eldef->{checker}->($self, $node);        push @todo, @$new_todos;
1714      push @nodes, @$children;      } elsif ($todo->{type} eq 'plus') {
1715          $self->_remove_minuses ($todo);
1716        }
1717    }    }
1718  } # check_element  } # check_element
1719    
# Line 1583  sub _add_minuses ($@) { Line 1730  sub _add_minuses ($@) {
1730        }        }
1731      }      }
1732    }    }
1733    return $r;    return {type => 'plus', list => $r};
1734  } # _add_minuses  } # _add_minuses
1735    
1736  sub _remove_minuses ($$) {  sub _remove_minuses ($$) {
1737    my ($self, $list) = @_;    my ($self, $todo) = @_;
1738    for my $ns (keys %{$list}) {    for my $ns (keys %{$todo->{list}}) {
1739      for my $ln (keys %{$list->{$ns}}) {      for my $ln (keys %{$todo->{list}->{$ns}}) {
1740        delete $self->{minuses}->{$ns}->{$ln} if $list->{$ns}->{$ln};        delete $self->{minuses}->{$ns}->{$ln} if $todo->{list}->{$ns}->{$ln};
1741      }      }
1742    }    }
1743    1;    1;
# Line 1598  sub _remove_minuses ($$) { Line 1745  sub _remove_minuses ($$) {
1745    
1746  sub _check_get_children ($$) {  sub _check_get_children ($$) {
1747    my ($self, $node) = @_;    my ($self, $node) = @_;
1748    my $ch = [];    my $new_todos = [];
1749    my $sib = [];    my $sib = [];
1750    TP: {    TP: {
1751      my $node_ns = $node->namespace_uri;      my $node_ns = $node->namespace_uri;
# Line 1641  sub _check_get_children ($$) { Line 1788  sub _check_get_children ($$) {
1788          unshift @$sib, @cn;          unshift @$sib, @cn;
1789        }        }
1790      }      }
1791      push @$ch, $node;      push @$new_todos, {type => 'element', node => $node};
1792    } # TP    } # TP
1793    return ($sib, $ch);    return ($sib, $new_todos);
1794  } # _check_get_children  } # _check_get_children
1795    
1796  1;  1;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24