# -*-perl-*-
#+##############################################################################
#
# noheaders.init: output html without headers. Obsoleted by --no-header
#
#    Copyright (C) 2003-2008  Patrice Dumas <dumas@centre-cired.fr>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301  USA
#
#-##############################################################################

#$SPLIT = 'none';

$print_section            = \&T2H_NOHEAD_print_section;
#$print_element_header            = \&T2H_NOHEAD_print_element_header;
$print_element_header            = \&T2H_NOHEAD_noop;
$end_section              = \&T2H_NOHEAD_end_section;
$one_section              = \&T2H_NOHEAD_one_section;
#$print_Top_header         = \&T2H_NOHEAD_print_Top_header;
$print_Top_footer	      = \&T2H_NOHEAD_print_Top_footer;
$print_Top                = \&T2H_NOHEAD_print_Top;
#$print_misc_header	      = \&T2H_NOHEAD_print_misc_header;
$print_misc_footer	      = \&T2H_NOHEAD_print_misc_footer;
#$print_misc		      = \&T2H_NOHEAD_print_misc;
#$print_head_navigation    = \&T2H_NOHEAD_print_head_navigation;
$print_head_navigation    = \&T2H_NOHEAD_noop;
$about_body		      = \&T2H_NOHEAD_about_body;
#$toc_body                 = \&T2H_NOHEAD_toc_body;

sub T2H_NOHEAD_noop
{
  return '';
}

########################################################################
# Layout for html for every sections
#

sub T2H_NOHEAD_print_section
{
    my $fh = shift;
    my $first_in_page = shift;
    my $previous_is_top = shift;
    my $nw = main::print_lines($fh);
}

sub T2H_NOHEAD_one_section($$)
{
    my $fh = shift;
    my $element = shift;
    main::print_lines($fh);
    print $fh "$SMALL_RULE\n";
    &$print_page_foot($fh);
}

###################################################################
# Layout of top-page I recommend that you use @ifnothtml, @ifhtml,
# @html within the Top texinfo node to specify content of top-level
# page.
#
# If you enclose everything in @ifnothtml, then title, subtitle,
# author and overview is printed
# Texi2HTML::HREF of Next, Prev, Up, Forward, Back are not defined
# if $T2H_SPLIT then Top page is in its own html file
sub T2H_NOHEAD_print_Top_footer($$)
{
    my $fh = shift;
    print $fh "$SMALL_RULE\n";
}
sub T2H_NOHEAD_print_Top
{
    my $fh = shift;
    my $has_top_heading = shift;

    # FIXME take what is in texi2html.init, or maybe this is not needed
    # anymore
    if (@$Texi2HTML::THIS_SECTION)
    {
        # if top-level node has content, then print it with extra header
        #print $fh "<h1>$Texi2HTML::NAME{Top}</h1>\n"
#        print $fh "<h1 class=\"settitle\">$Texi2HTML::NAME{Top}</h1>\n"
#            unless ($has_top_heading);
        main::print_lines($fh, $Texi2HTML::THIS_SECTION);
    }
    else
    {
        # top-level node is fully enclosed in @ifnothtml
        # print fulltitle, subtitle, author, Overview
        # redo the titlepage with the actual state
        my ($titlepage_text, $titlepage_no_texi, $titlepage_simple_text) = main::do_special_region_lines('titlepage',$Texi2HTML::THISDOC{'state'});
        &$titlepage([],$titlepage_text, $titlepage_no_texi, $titlepage_simple_text); 
        print $fh $Texi2HTML::TITLEPAGE;
        if (@{$Texi2HTML::OVERVIEW})
        {
             print $fh '<h2> ' . &$I('Overview:') . "</h2>\n" . "<blockquote>\n";
             my $nw = main::print_lines($fh, $Texi2HTML::OVERVIEW);
             print $fh "</blockquote>\n";
        }
        elsif (@{$Texi2HTML::TOC_LINES})
        {
             print $fh '<h1> ' . &$I('Table of contents') . "</h1>\n";
             my $nw = main::print_lines($fh, $Texi2HTML::TOC_LINES);
        }
    }
}

###################################################################
# Layout of Toc, Overview, and Footnotes pages
# By default, we use "normal" layout
# Texi2HTML::HREF of Next, Prev, Up, Forward, Back, etc are not defined
# use: my $buttons = [...] to redefine navigation buttons
sub T2H_NOHEAD_print_misc_header
{
    my $fh = shift;
    &$print_page_head($fh) if $SPLIT;
}
sub T2H_NOHEAD_print_misc_footer
{
    my $fh = shift;
    print $fh "$SMALL_RULE\n";
    if ($SPLIT)
    {
        &$print_page_foot($fh);
    }

}
sub T2H_NOHEAD_print_misc
{
    my $fh = shift;
    &$print_misc_header($fh);
    print $fh "<h1>$Texi2HTML::NAME{This}</h1>\n";
    main::print_lines($fh);
    &$print_misc_footer($fh);
}

sub T2H_NOHEAD_end_section($)
{
    my $fh = shift;
    print $fh "$BIG_RULE\n";
}

###################################################################
# Layout of navigation panel

sub T2H_NOHEAD_about_body
{
}

