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

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

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

$program_string

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