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

4c79b5
#!/bin/bash
4c79b5
#
c4fb9b
# help_editEntry.sh -- This function implements the edition flow of
4d0000
# documentation entries inside the working copy.
4c79b5
#
3b0984
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
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
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
c4fb9b
function help_editEntry {
4c79b5
20c5db
    # Print separator line.
18be6e
    cli_printMessage '-' --as-separator-line
20c5db
acd8f6
    # Verify section definition inside chapters. 
6e32b6
    if [[ ! -f $MANUAL_ENTRY ]];then
4d0000
420e77
        # Verify the parent directory of documentation entry. If the
420e77
        # parent directory of the current documentation entry doesn't
420e77
        # exist, create it and be sure it is added to version control.
420e77
        # Also, verify that the parent directory of the documentation
420e77
        # entry can be created. Otherwise, stop script execution with
420e77
        # an error for the user to be aware of it.
420e77
        if [[ ! -d $(dirname $(dirname $MANUAL_ENTRY)) ]];then
420e77
            cli_printMessage "`gettext "The documentation entry provided hasn't a parent directory."`" --as-error-line
420e77
        elif [[ ! -d $(dirname $MANUAL_ENTRY) ]];then
420e77
            svn mkdir $(dirname ${MANUAL_ENTRY}) --quiet
420e77
        fi
420e77
4d0000
        # Print confirmation question. 
4d0000
        cli_printMessage "`gettext "The following documentation section will be created:"`"
6e32b6
        cli_printMessage "$MANUAL_ENTRY" --as-response-line
18be6e
        cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line
4d0000
acd8f6
        # Update chapter section related menu.
9fa13b
        ${FUNCNAM}_updateMenu
acd8f6
acd8f6
        # Update chapter section related nodes (based on chapter
acd8f6
        # section related menu).
9fa13b
        ${FUNCNAM}_updateNodes
acd8f6
acd8f6
        # Update old missing cross references. If for some reason a
acd8f6
        # documentation entry is removed by mistake, and that mistake
acd8f6
        # is fixing by adding the removed documentation entry back
acd8f6
        # into the repository, rebuild the missing cross reference
acd8f6
        # message to use the correct link to the documentation
acd8f6
        # section.
9fa13b
        ${FUNCNAM}_restoreCrossReferences $MANUAL_ENTRY
4d0000
4d0000
    else
4d0000
4d0000
        # Print action message.
6e32b6
        cli_printMessage "$MANUAL_ENTRY" --as-updating-line
4d0000
4d0000
    fi
4c79b5
4c79b5
    # Use default text editor to edit the documentation entry.
6e32b6
    eval $EDITOR $MANUAL_ENTRY
4c79b5
4c79b5
}