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

4c79b5
#!/bin/bash
4c79b5
#
993f6a
# texinfo_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
993f6a
function texinfo_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
edaa9d
        # Verify chapter related to documentation entry. Inside
edaa9d
        # manuals, all documentation entries are stored directly under
edaa9d
        # its chapter directory. There is no more levels deep so it is
edaa9d
        # possible to perform a direct chapter verification here.
edaa9d
        if [[ ! -a $(dirname $MANUAL_ENTRY)/chapter.${MANUAL_EXTENSION} ]];then
edaa9d
            ${FLAG_BACKEND}_createChapter
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
edaa9d
        # Update section menu, nodes and cross references based on
edaa9d
        # changes in order for manual structure to remain cosistent.
edaa9d
        ${FLAG_BACKEND}_updateStructureSection "$MANUAL_ENTRY"
4d0000
4d0000
    else
4d0000
4d0000
        # Print action message.
6e32b6
        cli_printMessage "$MANUAL_ENTRY" --as-updating-line
4d0000
e34894
        # Rebuild menu definition set inside section entry using one
e34894
        # level ahead only.
e34894
        ${FLAG_BACKEND}_makeSeeAlso "$MANUAL_ENTRY"
f40c5c
4d0000
    fi
4c79b5
4c79b5
    # Use default text editor to edit the documentation entry.
6e32b6
    eval $EDITOR $MANUAL_ENTRY
4c79b5
4c79b5
}