html_css) { $metatags .= "\n"; } if ($self->html_javascript) { $metatags .= "\n"; } $self->{'scratch'} .= <<"HTML"; $doctype $title $metatags HTML $self->emit; } } sub end_Document { my ($self) = @_; my $to_index = $self->{'to_index'}; if ($self->index && @{ $to_index } ) { my @out; my $level = 0; my $indent = -1; my $space = ''; my $id = ' id="index"'; for my $h (@{ $to_index }, [0]) { my $target_level = $h->[0]; # Get to target_level by opening or closing ULs if ($level == $target_level) { $out[-1] .= ''; } elsif ($level > $target_level) { $out[-1] .= '' if $out[-1] =~ /^\s+
  • /; while ($level > $target_level) { --$level; push @out, (' ' x --$indent) . '
  • ' if @out && $out[-1] =~ m{^\s+<\/ul}; push @out, (' ' x --$indent) . ''; } push @out, (' ' x --$indent) . '' if $level; } else { while ($level < $target_level) { ++$level; push @out, (' ' x ++$indent) . '
  • ' if @out && $out[-1]=~ /^\s*