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

878a2b
#!/bin/bash
878a2b
#
878a2b
# texinfo_renameEntry.sh -- This function standardizes renaming tasks
878a2b
# related to manual, chapters and sections inside the working copy.
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 (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_renameEntry {
878a2b
878a2b
    # Initialize source and target locations.
878a2b
    local MANUAL_ENTRY_SRC=''
878a2b
    local MANUAL_ENTRY_DST=''
878a2b
878a2b
    # Define both source and target documentation entries. To build
878a2b
    # the source and target documentation entries we take into
878a2b
    # consideration the manual's main definition file, the chapter's
878a2b
    # main definition file and non-option arguments passed to
878a2b
    # centos-art.sh script through the command-line.
878a2b
    if [[ ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]} != '' ]];then
878a2b
878a2b
        # When a section is renamed, the section source location is
878a2b
        # duplicated into the section target location and later
878a2b
        # removed from the working copy. Once the section source
878a2b
        # location has been renamed, the section menu, nodes and cross
878a2b
        # references are updated to keep consistency inside the
878a2b
        # manual.
878a2b
        texinfo_renameEntrySection
878a2b
878a2b
    elif [[ ${MANUAL_CHAP[$MANUAL_DOCENTRY_ID]} != '' ]] \
878a2b
        && [[ ${MANUAL_CHAP[(($MANUAL_DOCENTRY_ID + 1))]} != '' ]];then
878a2b
878a2b
        # When a chapter is renamed, the chapter source location is
878a2b
        # duplicated into the chapter source location and later
878a2b
        # removed from the working copy. Once the chapter source
878a2b
        # location has been renamed, the chapter and section menu,
878a2b
        # nodes and cross references are updated to keep consistency
878a2b
        # inside the manual.
878a2b
        texinfo_renameEntryChapter
878a2b
878a2b
    elif [[ ${MANUAL_DIRN[$MANUAL_DOCENTRY_ID]} != '' ]] \
878a2b
        && [[ ${MANUAL_DIRN[(($MANUAL_DOCENTRY_ID + 1))]} != '' ]] ;then
878a2b
878a2b
        # When a manual is renamed, a new manual structure is created
878a2b
        # in the manual target location and all chapters and sections
878a2b
        # are duplicated from manual source location to manual target
878a2b
        # location. Once the source manual has been renamed, chapter
878a2b
        # and section menu, nodes and cross references are updated to
878a2b
        # keep consistency inside the manual.
878a2b
        texinfo_renameEntryManual
878a2b
878a2b
    else
878a2b
        cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line
878a2b
    fi
878a2b
878a2b
}