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

4c79b5
#!/bin/bash
4c79b5
#
1afa3c
# texinfo_editEntry.sh -- This function implements the edition flow of
4d0000
# documentation entries inside the working copy.
4c79b5
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
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
1afa3c
function texinfo_editEntry {
4c79b5
20c5db
    # Print separator line.
18be6e
    cli_printMessage '-' --as-separator-line
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:"`"
18be6e
        cli_printMessage "$MANUAL_CHAPTER_DIR" --as-response-line
18be6e
        cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line
4d0000
4d0000
        # Update manual chapter related files.
1afa3c
        texinfo_updateChaptersFiles
4d0000
4d0000
        # Update manual chapter related menu.
1afa3c
        texinfo_updateChaptersMenu
4d0000
4d0000
        # Update manual chapter related nodes (based on chapter
4d0000
        # related menu).
1afa3c
        texinfo_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:"`"
18be6e
        cli_printMessage "$ENTRY" --as-response-line
18be6e
        cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line
4d0000
acd8f6
        # Update chapter section related menu.
1afa3c
        texinfo_updateMenu
acd8f6
acd8f6
        # Update chapter section related nodes (based on chapter
acd8f6
        # section related menu).
1afa3c
        texinfo_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.
1afa3c
        texinfo_restoreCrossReferences
4d0000
4d0000
    else
4d0000
4d0000
        # Print action message.
18be6e
        cli_printMessage "$ENTRY" --as-updating-line
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.
1afa3c
    texinfo_updateOutputFiles
4c79b5
4c79b5
}