Blame Automation/Modules/Help/Texinfo/texinfo_editEntry.sh

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# texinfo_editEntry.sh -- This function implements the edition flow of
Alain Reguera Delgado 8f60cb
# documentation entries inside the working copy.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Copyright (C) 2009-2013 The CentOS Project
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 8f60cb
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 8f60cb
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 8f60cb
# your option) any later version.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 8f60cb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 8f60cb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 8f60cb
# General Public License for more details.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado 8f60cb
# along with this program; if not, write to the Free Software
Alain Reguera Delgado 8f60cb
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
# $Id$
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
function texinfo_editEntry {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Verify section definition inside chapters. 
Alain Reguera Delgado 8f60cb
    if [[ ! -f $MANUAL_ENTRY ]];then
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Verify chapter related to documentation entry. Inside
Alain Reguera Delgado 8f60cb
        # manuals, all documentation entries are stored directly under
Alain Reguera Delgado 8f60cb
        # its chapter directory. There is no more levels deep so it is
Alain Reguera Delgado 8f60cb
        # possible to perform a direct chapter verification here.
Alain Reguera Delgado 8f60cb
        if [[ ! -a $(dirname $MANUAL_ENTRY).${MANUAL_EXTENSION} ]];then
Alain Reguera Delgado 8f60cb
            texinfo_createChapter
Alain Reguera Delgado 8f60cb
        fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Print confirmation question. 
Alain Reguera Delgado 8f60cb
        cli_printMessage "`gettext "The following documentation section doesn't exist:"`" --as-stdout-line
Alain Reguera Delgado 8f60cb
        cli_printMessage "$MANUAL_ENTRY" --as-response-line
Alain Reguera Delgado 8f60cb
        cli_printMessage "`gettext "Do you want to create it now?"`" --as-yesornorequest-line
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Print action message.
Alain Reguera Delgado 8f60cb
        cli_printMessage "$MANUAL_ENTRY" --as-updating-line
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Update section menu, nodes and cross references based on
Alain Reguera Delgado 8f60cb
        # changes in order for manual structure to remain consistent.
Alain Reguera Delgado 8f60cb
        texinfo_updateStructureSection "$MANUAL_ENTRY"
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Use default text editor to write changes on documentation entry.
Alain Reguera Delgado 8f60cb
        $EDITOR $MANUAL_ENTRY
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    else
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Print action message.
Alain Reguera Delgado 8f60cb
        cli_printMessage "$MANUAL_ENTRY" --as-updating-line
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Rebuild section menu definitions before editing the
Alain Reguera Delgado 8f60cb
        # documentation entry. This way, if there is any change in the
Alain Reguera Delgado 8f60cb
        # section menu definition, it will be visible to you on
Alain Reguera Delgado 8f60cb
        # edition.
Alain Reguera Delgado 8f60cb
        texinfo_makeSeeAlso "$MANUAL_ENTRY"
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Use default text editor to write changes on documentation entry.
Alain Reguera Delgado 8f60cb
        $EDITOR $MANUAL_ENTRY
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
        # Rebuild section menu definitions after editing the
Alain Reguera Delgado 8f60cb
        # documentation entry. This way, if there is any change or
Alain Reguera Delgado 8f60cb
        # expansion to realize in the section menu definition, it be
Alain Reguera Delgado 8f60cb
        # applied right now. Don't see a reason for waiting until the
Alain Reguera Delgado 8f60cb
        # next edition for expansions to happen.
Alain Reguera Delgado 8f60cb
        texinfo_makeSeeAlso "$MANUAL_ENTRY"
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Rebuild output files to propagate recent changes, if any.
Alain Reguera Delgado 8f60cb
    texinfo_updateOutputFiles
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}