Blame Scripts/Bash/Functions/Help/Texinfo/texinfo_copyEntry.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# texinfo_copyEntry.sh -- This function standardizes the duplication
878a2b
# actions related to manuals written in texinfo format. This function
878a2b
# duplicates manuals, chapters inside manuals, and sections inside
878a2b
# chapters.
878a2b
#
03486a
# Copyright (C) 2009, 2010, 2011, 2012 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 (at
878a2b
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
878a2b
#
878a2b
# ----------------------------------------------------------------------
878a2b
# $Id$
878a2b
# ----------------------------------------------------------------------
878a2b
878a2b
function texinfo_copyEntry {
878a2b
878a2b
    # Initialize source and target locations.
878a2b
    local MANUAL_ENTRY_SRC=''
878a2b
    local MANUAL_ENTRY_DST=''
878a2b
878a2b
    # Execute copying action based on documentation entries passed as
878a2b
    # non-option arguments to `centos-art.sh' script in the
878a2b
    # command-line.
878a2b
    if [[ ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]} != '' ]];then
878a2b
878a2b
        # In this configuration, the section name is specified in
878a2b
        # first non-option argument and optionally in the second
7fa409
        # non-option argument.
878a2b
        texinfo_copyEntrySection
878a2b
         
878a2b
    elif [[ ${MANUAL_CHAP[${MANUAL_DOCENTRY_ID}]} != '' ]] \
878a2b
        && [[ ${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then
878a2b
878a2b
        # In this configuration, the section name wasn't specified
878a2b
        # neither in first or second non-option argument.  So, we
878a2b
        # perform a copying action for the chapter directory itself.
878a2b
        # In this configuration, the whole chapter directory and all
878a2b
        # the content inside are duplicated from source to target.
878a2b
        texinfo_copyEntryChapter
878a2b
878a2b
    elif [[ ${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]} != '' ]] \
878a2b
        && [[ ${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then
878a2b
878a2b
        # In this configuration, the chapter name wasn't specified
878a2b
        # neither in first or second non-option argument. So, we
878a2b
        # perform copying actions on manual directory itself.  Notice
878a2b
        # that, in this configuration, the whole manual is duplicated.
878a2b
        texinfo_copyEntryManual
878a2b
878a2b
        # In this configuration, there is no need to update section
7fa409
        # menus, nodes and cross references. The section definition
878a2b
        # files were copied from the source manual with any change so
878a2b
        # the manual should build without any problem. Be sure such
878a2b
        # verification will never happen.
878a2b
878a2b
    else
878a2b
        cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line
878a2b
    fi
878a2b
878a2b
}