Blame Scripts/Functions/Help/Texinfo/Templates/manual-init.pl

89be06
#!/usr/bin/perl 
89be06
#
89be06
# repository.init -- This file initializes Texi2HTML program to
89be06
# produce the repository documentation manual using the CentOS Web
89be06
# Environment XHTML and CSS standard definition.
89be06
#
932e04
# Copyright (C) 2009, 2010, 2011 The CentOS Project
89be06
# 
89be06
# This program is free software; you can redistribute it and/or modify
89be06
# it under the terms of the GNU General Public License as published by
89be06
# the Free Software Foundation; either version 2 of the License, or
89be06
# (at your option) any later version.
89be06
#  
89be06
# This program is distributed in the hope that it will be useful, but
89be06
# WITHOUT ANY WARRANTY; without even the implied warranty of
89be06
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
89be06
# General Public License for more details.
89be06
# 
89be06
# You should have received a copy of the GNU General Public License
89be06
# along with this program; if not, write to the Free Software
89be06
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
89be06
# USA.
89be06
# ----------------------------------------------------------------------
89be06
# $Id$
89be06
# ----------------------------------------------------------------------
89be06
89be06
# -iso
89be06
# if set, ISO8859 characters are used for special symbols (like
89be06
# copyright, etc)
89be06
$USE_ISO = 1;
89be06
89be06
# -I
89be06
# add a directory to the list of directories where @include files are
89be06
# searched for (besides the directory of the file). additional '-I'
89be06
# args are appended to this list.  (APA: Don't implicitely search .,
89be06
# to conform with the docs!) my @INCLUDE_DIRS = (".");
89be06
@INCLUDE_DIRS = ("/home/centos/artwork");
89be06
89be06
# Extension used on output files.
89be06
$EXTENSION = "xhtml";
89be06
89be06
# Horizontal rules.
89be06
$DEFAULT_RULE = '

';
89be06
$SMALL_RULE = $DEFAULT_RULE;
89be06
$MIDDLE_RULE = $DEFAULT_RULE;
89be06
$BIG_RULE = $DEFAULT_RULE;
89be06
89be06
# -split section|chapter|node|none
89be06
# if $SPLIT is set to 'section' (resp. 'chapter') one html file per
89be06
# section (resp. chapter) is generated. If $SPLIT is set to 'node' one
89be06
# html file per node or sectionning element is generated. In all these
89be06
# cases separate pages for Top, Table of content (Toc), Overview and
89be06
# About are generated.  Otherwise a monolithic html file that contains
89be06
# the whole document is created.
89be06
$SPLIT = 'section';
89be06
89be06
# -sec-nav|-nosec-nav
89be06
# if this is set then navigation panels are printed at the beginning
89be06
# of each section.  If the document is split at nodes then navigation
89be06
# panels are printed at the end if there were more than $WORDS_IN_PAGE
89be06
# words on page.
89be06
#
89be06
# If the document is split at sections this is ignored.
89be06
#
89be06
# This is most useful if you do not want to have section navigation
89be06
# with -split chapter. There will be chapter navigation panel at the
89be06
# beginning and at the end of chapters anyway.
89be06
$SECTION_NAVIGATION = 1;
89be06
89be06
# Layout control
89be06
$print_page_head	= \&T2H_XHTML_print_page_head;
89be06
$print_page_foot	= \&T2H_XHTML_print_page_foot;
89be06
$print_frame        = \&T2H_XHTML_print_frame;
89be06
$button_icon_img    = \&T2H_XHTML_button_icon_img;
89be06
$print_navigation   = \&T2H_XHTML_print_navigation;
89be06
89be06
#FIXME update once it is more stabilized in texi2html.init
89be06
sub T2H_XHTML_print_page_head
89be06
{
89be06
    my $fh = shift;
89be06
    my $longtitle = "$Texi2HTML::THISDOC{'title_unformatted'}";
89be06
    $longtitle .= ": $Texi2HTML::UNFORMATTED{'This'}" if exists $Texi2HTML::UNFORMATTED{'This'};
89be06
    print $fh <
89be06
89be06
89be06
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
89be06
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
89be06
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$LANG" lang="$LANG">
89be06
<head>
89be06
89be06
    <title>$longtitle</title>
89be06
89be06
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
89be06
    <meta name="description" content="$longtitle" />
89be06
    <meta name="keywords" content="$longtitle" />
89be06
    <meta name="resource-type" content="document" />
89be06
    <meta name="distribution" content="global" />
89be06
    <meta name="generator" content="$Texi2HTML::THISDOC{program}" />
89be06
    <meta name="copyright" content="2009, 2010, 2011 The CentOS Project" />
89be06
89be06
    <link href="/home/centos/artwork/trunk/Identity/Webenv/Css/Texi2html/default.css" rel="stylesheet" type="text/css" media="screen projection" />
89be06
89be06
</head>
89be06
89be06
<body>
89be06
89be06
89be06
89be06
89be06
89be06
    
89be06
89be06
        
89be06
89be06
89be06
EOT
89be06
}
89be06
89be06
sub T2H_XHTML_print_page_foot
89be06
{
89be06
    my $fh = shift;
89be06
    my @date=localtime(time);
89be06
    my $year=$date[5] += 1900;
89be06
    my $program_string = program_string();
89be06
    print $fh <
89be06
89be06
        

$program_string

89be06
89be06
        
89be06
89be06
    
89be06
89be06
89be06
89be06
89be06
</body>
89be06
89be06
</html>
89be06
EOT
89be06
}
89be06
89be06
# / in 
89be06
sub T2H_XHTML_button_icon_img
89be06
{
89be06
    my $button = shift;
89be06
    my $icon = shift;
89be06
    my $name = shift;
89be06
    return '' if (!defined($icon));
89be06
    if (defined($name) && $name)
89be06
    {
89be06
        $name = ": $name";
89be06
    }
89be06
    else
89be06
    {
89be06
        $name = '';
89be06
    }
89be06
    $button = "" if (!defined ($button));
89be06
    return qq{$button$name};
89be06
}
89be06
89be06
$simple_map{'*'} = '
';
89be06
89be06
# formatting functions
89be06
89be06
$def_line	       = \&t2h_xhtml_def_line;
89be06
$index_summary     = \&t2h_xhtml_index_summary;
89be06
$image             = \&t2h_xhtml_image;
89be06
89be06
# need / in 
89be06
sub t2h_xhtml_image($$$)
89be06
{
89be06
   my $file = shift;
89be06
   my $base = shift;
89be06
   my $preformatted = shift;
89be06
   return "[ $base ]" if ($preformatted);
89be06
   return "\"$base\"";
89be06
}
89be06
89be06
# process definition commands line @deffn for example
89be06
# <u> replaced by 
89be06
sub t2h_xhtml_def_line($$$$$)
89be06
{
89be06
   my $category = shift;
89be06
   my $name = shift;
89be06
   my $type = shift;
89be06
   my $arguments = shift;
89be06
   my $index_label = shift;
89be06
   $index_label = '' if (!defined($index_label));
89be06
   $name = '' if (!defined($name) or ($name =~ /^\s*$/));
89be06
   $type = '' if (!defined($type) or $type =~ /^\s*$/);
89be06
   if (!defined($arguments) or $arguments =~ /^\s*$/)
89be06
   {
89be06
       $arguments = '';
89be06
   }
89be06
   else
89be06
   {
89be06
       $arguments = '' . $arguments . '';
89be06
   }
89be06
   my $type_name = '';
89be06
   $type_name = " $type" if ($type ne '');
89be06
   $type_name .= ' ' . $name . '' if ($name ne '');
89be06
   $type_name .= $arguments . "\n";
89be06
   if (! $DEF_TABLE)
89be06
   {
89be06
       return '
'. '' . $category . ':' . $type_name . $index_label . "
\n";
89be06
   }
89be06
   else
89be06
   {
89be06
       
89be06
       return "\n" . $type_name . 
89be06
       "\n" . $category . $index_label . "\n" . "\n";
89be06
   }
89be06
}
89be06
89be06
# There is a br which needs / 
89be06
sub t2h_xhtml_index_summary($$)
89be06
{
89be06
    my $alpha = shift;
89be06
    my $nonalpha = shift;
89be06
    my $join = '';
89be06
    my $nonalpha_text = '';
89be06
    my $alpha_text = '';
89be06
    $join = "   \n
\n" if (@$nonalpha and @$alpha);
89be06
    if (@$nonalpha)
89be06
    {
89be06
       $nonalpha_text = join("\n   \n", @$nonalpha) . "\n";
89be06
    }
89be06
    if (@$alpha)
89be06
    {
89be06
       $alpha_text = join("\n   \n", @$alpha) . "\n   \n";
89be06
    }
89be06
    #I18n
89be06
    return "
" . &$I('Jump to') . ":   " .
89be06
    $nonalpha_text . $join . $alpha_text . '';
89be06
}
89be06
89be06
# Layout of navigation panel
89be06
sub T2H_XHTML_print_navigation
89be06
{
89be06
    my $fh = shift;
89be06
    my $buttons = shift;
89be06
    my $vertical = shift;
89be06
    print $fh '' . "\n";
89be06
89be06
    print $fh "" unless $vertical;
89be06
    for my $button (@$buttons)
89be06
    {
89be06
        print $fh qq{\n} if $vertical;
89be06
        print $fh qq{};
89be06
89be06
        if (ref($button) eq 'CODE')
89be06
        {
89be06
            &$button($fh, $vertical);
89be06
        }
89be06
        elsif (ref($button) eq 'SCALAR')
89be06
        {
89be06
            print $fh "$$button" if defined($$button);
89be06
        }
89be06
        elsif (ref($button) eq 'ARRAY')
89be06
        {
89be06
            my $text = $button->[1];
89be06
            my $button_href = $button->[0];
89be06
            if (defined($button_href) and !ref($button_href) 
89be06
               and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
89be06
            {             # use given text
89be06
                if ($Texi2HTML::HREF{$button_href})
89be06
                {
89be06
                  print $fh "" .
89be06
                        &$anchor('',
89be06
                                    $Texi2HTML::HREF{$button_href},
89be06
                                    $$text
89be06
                                   ) 
89be06
                                    ;
89be06
                }
89be06
                else
89be06
                {
89be06
                  print $fh $$text;
89be06
                }
89be06
            }
89be06
        }
89be06
        elsif ($button eq ' ')
89be06
        {                       # handle space button
89be06
            print $fh
89be06
                $ICONS && $ACTIVE_ICONS{' '} ?
89be06
                    &$button_icon_img($button, $ACTIVE_ICONS{' '}) :
89be06
                        $NAVIGATION_TEXT{' '};
89be06
            #next;
89be06
        }
89be06
        elsif ($Texi2HTML::HREF{$button})
89be06
        {                       # button is active
89be06
            my $btitle = $BUTTONS_GOTO{$button} ?
89be06
                'title="' . ucfirst($BUTTONS_GOTO{$button}) . '"' : '';
89be06
            if ($ICONS && $ACTIVE_ICONS{$button})
89be06
            {                   # use icon
89be06
                print $fh '' .
89be06
                    &$anchor('',
89be06
                        $Texi2HTML::HREF{$button},
89be06
                        &$button_icon_img($button,
89be06
                                   $ACTIVE_ICONS{$button},
89be06
                                   #$Texi2HTML::NAME{$button}),
89be06
                                   $Texi2HTML::NO_TEXI{$button}),
89be06
                        $btitle
89be06
                      );
89be06
            }
89be06
            else
89be06
            {                   # use text
89be06
                print $fh
89be06
                    '[' .
89be06
                        &$anchor('',
89be06
                                    $Texi2HTML::HREF{$button},
89be06
                                    $NAVIGATION_TEXT{$button},
89be06
                                    $btitle
89be06
                                   ) .
89be06
                                       ']';
89be06
            }
89be06
        }
89be06
        else
89be06
        {                       # button is passive
89be06
            print $fh
89be06
                $ICONS && $PASSIVE_ICONS{$button} ?
89be06
                    &$button_icon_img($button,
89be06
                                          $PASSIVE_ICONS{$button},
89be06
                                          #$Texi2HTML::NAME{$button}) :
89be06
                                          $Texi2HTML::NO_TEXI{$button}) :
89be06
89be06
                                              "[" . $NAVIGATION_TEXT{$button} . "]";
89be06
        }
89be06
        print $fh "\n";
89be06
        print $fh "\n" if $vertical;
89be06
    }
89be06
    print $fh "" unless $vertical;
89be06
    print $fh "\n";
89be06
}
89be06
89be06
# Use icons for navigation.
89be06
$ICONS = 0;
89be06
89be06
# insert here name of icon images for buttons
89be06
# Icons are used, if $ICONS and resp. value are set
89be06
%ACTIVE_ICONS =
89be06
    (
89be06
     'Top',         'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-top.png',
89be06
     'Contents',    'file:///usr/share/icons/Bluecurve/24x24/stock/help-contents.png',
89be06
     'Overview',    '',
89be06
     'Index',       'file:///usr/share/icons/Bluecurve/24x24/stock/stock-find.png',
89be06
     'This',        '',
89be06
     'Back',        'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png',
89be06
     'FastBack',    'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-first.png',
89be06
     'Prev',        'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png',
89be06
     'Up',          'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-up.png',
89be06
     'Next',        'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png',
89be06
     'NodeUp',      'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-up.png',
89be06
     'NodeNext',    'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png',
89be06
     'NodePrev',    'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png',
89be06
     'Following',   'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png',
89be06
     'Forward',     'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png',
89be06
     'FastForward', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-last.png',
89be06
     'About' ,      'file:///usr/share/icons/Bluecurve/24x24/stock/gtk-about.png',
89be06
     'First',       'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-first.png',
89be06
     'Last',        'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-last.png',
89be06
     ' ',           ''
89be06
    );
89be06
89be06
# Insert here name of icon images for these, if button is inactive
89be06
%PASSIVE_ICONS =
89be06
    (
89be06
     'Top',         'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-top.png',
89be06
     'Contents',    'file:///usr/share/icons/Bluecurve/24x24/stock/help-contents.png',
89be06
     'Overview',    '',
89be06
     'Index',       'file:///usr/share/icons/Bluecurve/24x24/stock/stock-find.png',
89be06
     'This',        '',
89be06
     'Back',        'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png',
89be06
     'FastBack',    'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-first.png',
89be06
     'Prev',        'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png',
89be06
     'Up',          'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-up.png',
89be06
     'Next',        'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png',
89be06
     'NodeUp',      'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-up.png',
89be06
     'NodeNext',    'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png',
89be06
     'NodePrev',    'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-back.png',
89be06
     'Following',   'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png',
89be06
     'Forward',     'file:///usr/share/icons/Bluecurve/24x24/stock/stock-go-forward.png',
89be06
     'FastForward', 'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-last.png',
89be06
     'About' ,      'file:///usr/share/icons/Bluecurve/24x24/stock/gtk-about.png',
89be06
     'First',       'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-first.png',
89be06
     'Last',        'file:///usr/share/icons/Bluecurve/24x24/stock/stock-goto-last.png',
89be06
     ' ',           ''
89be06
    );
89be06
89be06
return 1;