# tag => [ povinny endtag, content], undef = [0, [] ] tj prazdny bez endtagu
@inline = ( 'tt', 'i', 'b', 'a', 'img', 'br', 'TEXT', 'TEXT_S', 'font',
            'span', 'sub', 'sup' );
@inline_a = ( 'tt', 'i', 'b', 'img', 'br', 'TEXT', 'TEXT_S', 'font' );
@block = ( 'p', 'h1', 'h2', 'h3', 'h4', 'ul', 'ol', 'dl',
           'pre', 'div', 'blockquote', 'hr', 'table', 'TEXT_S', 'script',
           'map', 'form', 'center' );
@indiv = (@block, 'map', 'area' );
@flow = (@inline, @block);

sub ImplicitP
{
    my $this = shift;
    $_ = shift ;
    my $node = shift;

    m<^(tt|i|b|a|img|br|TEXT|TEXT_S|font)$> || return undef;

    $this->IPrint( "$node->{'fl'} implicit start of p " .
                   "because of $_" );

    $this->start( 'p', {} );
    return 1;
}

sub InList
{
    my $this = shift;
    $_ = shift ;
    my $node = shift;

    m<^(p)$> && return 0;
    return undef;
}


{
# top level
 'FILE'     => [ 1, [ 'html', 'TEXT_S' ] ],
 'html'     => [ 0, [ 'head', 'body', 'TEXT_S' ] ],
 'head'     => [ 0, [ 'meta', 'title', 'link', 'script', 'TEXT_S' ] ],
 'title'    => [ 1, [ 'TEXT' ] ],
 'meta'     => undef, 
 'link'     => undef, 
 'body'     => [ 0, \@block, \&ImplicitP ],
# inline elements
 'tt'       => [ 1, \@inline  ],
 'i'        => [ 1, \@inline  ],
 'b'        => [ 1, \@inline  ],
 'span'     => [ 0, \@inline  ],
 'a'        => [ 1, \@inline_a ],
 'br'       => undef,
 'img'      => undef,
# block elements
 'input'    => undef,
 'div'      => [ 1, \@indiv, \&ImplicitP ],
 'map'      => [ 1, [ 'area', 'TEXT_S' ] ],
 'area'     => undef,
 'hr'       => undef,
 'p'        => [ 0, \@inline ],
 'h1'       => [ 1, \@inline ],
 'h2'       => [ 1, \@inline ],
 'h3'       => [ 1, \@inline ],
 'h4'       => [ 1, \@inline ],
 'blockquote' => [ 1, \@block, \&ImplicitP ],
 #lists
 'dl'       => [ 1, [ 'dt', 'dd', 'TEXT_S' ], \&InList ],
 'dt'       => [ 0, \@inline, \&ImplicitP ],
 'dd'       => [ 0, \@block, \&ImplicitP ],
 'ol'       => [ 1, [ 'li', 'TEXT_S' ] ],
 'ul'       => [ 1, [ 'li', 'TEXT_S' ] ],
 'li'       => [ 0, \@block, \&ImplicitP ],
 #tables
 'table'    => [ 1, [ 'caption', 'tr', 'TEXT_S' ] ],
 'caption'  => [ 1, \@inline ],
 'tr'       => [ 0, [ 'td', 'th', 'TEXT_S' ] ],
 'td'       => [ 0, \@flow ],
};

