Blame Scripts/CentOS-Art/Functions/Help/Texinfo/texinfo_deleteEntryChapter.sh

d92dde
#!/bin/bash
d92dde
#
d92dde
# texinfo_deleteEntryChapter.sh -- This function standardizes chapter
d92dde
# deletion inside the manual structure.
d92dde
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
d92dde
#
d92dde
# This program is free software; you can redistribute it and/or modify
d92dde
# it under the terms of the GNU General Public License as published by
d92dde
# the Free Software Foundation; either version 2 of the License, or (at
d92dde
# your option) any later version.
d92dde
#
d92dde
# This program is distributed in the hope that it will be useful, but
d92dde
# WITHOUT ANY WARRANTY; without even the implied warranty of
d92dde
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
d92dde
# General Public License for more details.
d92dde
#
d92dde
# You should have received a copy of the GNU General Public License
d92dde
# along with this program; if not, write to the Free Software
d92dde
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
d92dde
#
d92dde
# ----------------------------------------------------------------------
d92dde
# $Id$
d92dde
# ----------------------------------------------------------------------
d92dde
d92dde
function texinfo_deleteEntryChapter {
d92dde
c572ed
    # Print action message.
e7414c
    cli_printMessage "$MANUAL_CHAPTER_DIR" --as-deleting-line
c572ed
c572ed
    # Verify existence of documentation entry before deleting it. We
c572ed
    # cannot delete an entry which doesn't exist.
e7414c
    cli_checkFiles "$MANUAL_CHAPTER_DIR"
c572ed
d92dde
    # Build list of section entries inside the chapter. This is
d92dde
    # required to delete cross references from other section entries
d92dde
    # that point to section entries inside the chapter that will be
d92dde
    # deleted. Take care don't include the chapter definition files.
d92dde
    local MANUAL_ENTRIES=$(cli_getFilesList $MANUAL_CHAPTER_DIR \
d92dde
        --pattern=".+\.${MANUAL_EXTENSION}" \
d92dde
        | egrep -v '/chapter')
d92dde
c572ed
    # Revert pending changes before deleting.
c572ed
    svn revert ${MANUAL_CHAPTER_DIR} --quiet --recursive
c572ed
d92dde
    # Remove chapter directory using subversion to register the
d92dde
    # change.
d92dde
    svn del ${MANUAL_CHAPTER_DIR} --quiet
d92dde
d92dde
    # Update chapter menu and nodes inside manual structure.
ef43e2
    texinfo_updateChapterMenu --delete-entry
ef43e2
    texinfo_updateChapterNodes
d92dde
d92dde
    # Loop through section entries retrived from chapter, before
d92dde
    # deleting it, in order to remove cross references pointing to
d92dde
    # those section entries. Since the chapter and all its sections
d92dde
    # have been removed, cross references pointing them will point to
d92dde
    # non-existent section entries. This way, all cross references
d92dde
    # pointing to non-existent section entries will be transformed in
d92dde
    # order for documentors to advertise the section entry state.
d92dde
    for MANUAL_ENTRY in $MANUAL_ENTRIES;do
ef43e2
        texinfo_deleteCrossReferences ${MANUAL_ENTRY}
d92dde
    done
d92dde
d92dde
}
d92dde