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

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