Blame Scripts/Functions/Help/help_editEntry.sh

4c79b5
#!/bin/bash
4c79b5
#
0211a4
# help_editEntry.sh -- This function implements the edition flow of
4d0000
# documentation entries inside the working copy.
4c79b5
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
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.
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
0211a4
function help_editEntry {
4c79b5
20c5db
    # Print separator line.
20c5db
    cli_printMessage '-' 'AsSeparatorLine'
20c5db
acd8f6
    # Verify chapter definition inside manual.
7f7f8f
    if [[ ! -d $MANUAL_CHAPTER_DIR ]];then
4c79b5
4d0000
        # Print confirmation question.
4d0000
        cli_printMessage "`gettext "The following documentation chapter will be created:"`"
7f7f8f
        cli_printMessage "$MANUAL_CHAPTER_DIR" "AsResponseLine"
4d0000
        cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine"
4d0000
4d0000
        # Update manual chapter related files.
0211a4
        help_updateChaptersFiles
4d0000
4d0000
        # Update manual chapter related menu.
0211a4
        help_updateChaptersMenu
4d0000
4d0000
        # Update manual chapter related nodes (based on chapter
4d0000
        # related menu).
0211a4
        help_updateChaptersNodes
4d0000
4d0000
    fi
4d0000
acd8f6
    # Verify section definition inside chapters. 
4d0000
    if [[ ! -f $ENTRY ]];then
4d0000
4d0000
        # Print confirmation question. 
4d0000
        cli_printMessage "`gettext "The following documentation section will be created:"`"
4d0000
        cli_printMessage "$ENTRY" "AsResponseLine"
4d0000
        cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine"
4d0000
acd8f6
        # Update chapter section related menu.
0211a4
        help_updateMenu
acd8f6
acd8f6
        # Update chapter section related nodes (based on chapter
acd8f6
        # section related menu).
0211a4
        help_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.
0211a4
        help_restoreCrossReferences
4d0000
4d0000
    else
4d0000
4d0000
        # Print action message.
4d0000
        cli_printMessage "$ENTRY" 'AsUpdatingLine'
4d0000
4d0000
    fi
4c79b5
4c79b5
    # Use default text editor to edit the documentation entry.
4c79b5
    eval $EDITOR $ENTRY
4c79b5
4d0000
    # Rebuild output files to propagate recent changes.
0211a4
    help_updateOutputFiles
4c79b5
4c79b5
}