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

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# texinfo_renameEntry.sh -- This function standardizes renaming tasks
Alain Reguera Delgado 8f60cb
# related to manual, chapters and sections inside the working copy.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Copyright (C) 2009-2013 The CentOS Project
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 8f60cb
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 8f60cb
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 8f60cb
# your option) any later version.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 8f60cb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 8f60cb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 8f60cb
# General Public License for more details.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado 8f60cb
# along with this program; if not, write to the Free Software
Alain Reguera Delgado 8f60cb
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
# $Id$
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
function texinfo_renameEntry {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Initialize source and target locations.
Alain Reguera Delgado 8f60cb
    local MANUAL_ENTRY_SRC=''
Alain Reguera Delgado 8f60cb
    local MANUAL_ENTRY_DST=''
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define both source and target documentation entries. To build
Alain Reguera Delgado 8f60cb
    # the source and target documentation entries we take into
Alain Reguera Delgado 8f60cb
    # consideration the manual's main definition file, the chapter's
Alain Reguera Delgado 8f60cb
    # main definition file and non-option arguments passed to
Alain Reguera Delgado 8f60cb
    # centos-art.sh script through the command-line.
Alain Reguera Delgado 8f60cb
    if [[ ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]} != '' ]];then
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # When a section is renamed, the section source location is
Alain Reguera Delgado 8f60cb
        # duplicated into the section target location and later
Alain Reguera Delgado 8f60cb
        # removed from the working copy. Once the section source
Alain Reguera Delgado 8f60cb
        # location has been renamed, the section menu, nodes and cross
Alain Reguera Delgado 8f60cb
        # references are updated to keep consistency inside the
Alain Reguera Delgado 8f60cb
        # manual.
Alain Reguera Delgado 8f60cb
        texinfo_renameEntrySection
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    elif [[ ${MANUAL_CHAP[$MANUAL_DOCENTRY_ID]} != '' ]] \
Alain Reguera Delgado 8f60cb
        && [[ ${MANUAL_CHAP[(($MANUAL_DOCENTRY_ID + 1))]} != '' ]];then
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # When a chapter is renamed, the chapter source location is
Alain Reguera Delgado 8f60cb
        # duplicated into the chapter source location and later
Alain Reguera Delgado 8f60cb
        # removed from the working copy. Once the chapter source
Alain Reguera Delgado 8f60cb
        # location has been renamed, the chapter and section menu,
Alain Reguera Delgado 8f60cb
        # nodes and cross references are updated to keep consistency
Alain Reguera Delgado 8f60cb
        # inside the manual.
Alain Reguera Delgado 8f60cb
        texinfo_renameEntryChapter
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    elif [[ ${MANUAL_DIRN[$MANUAL_DOCENTRY_ID]} != '' ]] \
Alain Reguera Delgado 8f60cb
        && [[ ${MANUAL_DIRN[(($MANUAL_DOCENTRY_ID + 1))]} != '' ]] ;then
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # When a manual is renamed, a new manual structure is created
Alain Reguera Delgado 8f60cb
        # in the manual target location and all chapters and sections
Alain Reguera Delgado 8f60cb
        # are duplicated from manual source location to manual target
Alain Reguera Delgado 8f60cb
        # location. Once the source manual has been renamed, chapter
Alain Reguera Delgado 8f60cb
        # and section menu, nodes and cross references are updated to
Alain Reguera Delgado 8f60cb
        # keep consistency inside the manual.
Alain Reguera Delgado 8f60cb
        texinfo_renameEntryManual
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    else
Alain Reguera Delgado 8f60cb
        cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line
Alain Reguera Delgado 8f60cb
    fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}