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
f20c76
        # Use default text editor to write changes on documentation entry.
f20c76
        $EDITOR $MANUAL_ENTRY
f20c76
4d0000
    else
4d0000
4d0000
        # Print action message.
6e32b6
        cli_printMessage "$MANUAL_ENTRY" --as-updating-line
4d0000
4bbb02
        # Rebuild section menu definitions before editing the
4bbb02
        # documentation entry. This way, if there is any change in the
4bbb02
        # section menu definition, it will be visible to you on
4bbb02
        # edition.
e34894
        ${FLAG_BACKEND}_makeSeeAlso "$MANUAL_ENTRY"
f40c5c
f20c76
        # Use default text editor to write changes on documentation entry.
f20c76
        $EDITOR $MANUAL_ENTRY
4c79b5
f20c76
        # Rebuild section menu definitions after editing the
f20c76
        # documentation entry. This way, if there is any change or
f20c76
        # expansion to realize in the section menu definition, it be
f20c76
        # applied right now. Don't see a reason for waiting until the
f20c76
        # next edition for expansions to happen.
f20c76
        ${FLAG_BACKEND}_makeSeeAlso "$MANUAL_ENTRY"
f20c76
f20c76
    fi
4c79b5
4c79b5
}