Blame Scripts/Bash/Cli/Functions/Manual/manual_editEntry.sh

4c79b5
#!/bin/bash
4c79b5
#
4d0000
# manual_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
4c79b5
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# License, or (at your option) any later version.
72c8a5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# 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
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
4de5d4
function manual_editEntry {
4c79b5
4d0000
    # Verify definition of manual chapters. Definition of manual
4d0000
    # chapters sets how many chapters does the manual has and the
4d0000
    # directory and file structure required to make them active part
4d0000
    # of a texinfo 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.
4d0000
        manual_updateChaptersFiles
4d0000
4d0000
        # Update manual chapter related menu.
4d0000
        manual_updateChaptersMenu
4d0000
4d0000
        # Update manual chapter related nodes (based on chapter
4d0000
        # related menu).
4d0000
        manual_updateChaptersNodes
4d0000
4d0000
    fi
4d0000
4d0000
    # Verify definition of chapter sections. Definition of chapter
4d0000
    # sections sets how many sections does each chapter, inside the
4d0000
    # manual, has.
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
4d0000
        # Print action message.
4d0000
        cli_printMessage "$ENTRY" 'AsCreatingLine'
4d0000
4d0000
    else
4d0000
4d0000
        # Print action message.
4d0000
        cli_printMessage "$ENTRY" 'AsUpdatingLine'
4d0000
4d0000
    fi
4c79b5
04e3d0
    # Update chapter section related menu.
04e3d0
    manual_updateMenu
04e3d0
04e3d0
    # Update chapter section related nodes (based on chapter section
04e3d0
    # related menu).
04e3d0
    manual_updateNodes
04e3d0
04e3d0
    # Update old missing cross references. If for some reason a
04e3d0
    # documentation entry is removed by mistake, and that mistake is
04e3d0
    # fixing by adding the removed documentation entry back into the
04e3d0
    # repository, rebuild the missing cross reference message to use
04e3d0
    # the correct link to the documentation section.
04e3d0
    manual_restoreCrossReferences
04e3d0
4c79b5
    # Use default text editor to edit the documentation entry.
4c79b5
    eval $EDITOR $ENTRY
4c79b5
4d0000
    # Print separator line.
4d0000
    cli_printMessage '-' 'AsSeparatorLine'
4d0000
4d0000
    # Rebuild output files to propagate recent changes.
4de5d4
    manual_updateOutputFiles
4c79b5
4c79b5
}