Blame Manuals/TCAR-UG/Texinfo/tcar-ug-init.pl

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

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

$program_string

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