Blame Scripts/Functions/Help/Texinfo/texinfo_createStructure.sh

2c488f
#!/bin/bash
2c488f
#
993f6a
# texinfo_createStructure.sh -- This function creates the
2c488f
# documentation structure of a manual using the current language as
2c488f
# reference.
2c488f
#
3b0984
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
2c488f
#
2c488f
# This program is free software; you can redistribute it and/or modify
2c488f
# it under the terms of the GNU General Public License as published by
2c488f
# the Free Software Foundation; either version 2 of the License, or (at
2c488f
# your option) any later version.
2c488f
#
2c488f
# This program is distributed in the hope that it will be useful, but
2c488f
# WITHOUT ANY WARRANTY; without even the implied warranty of
2c488f
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2c488f
# General Public License for more details.
2c488f
#
2c488f
# You should have received a copy of the GNU General Public License
2c488f
# along with this program; if not, write to the Free Software
2c488f
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2c488f
#
2c488f
# ----------------------------------------------------------------------
2c488f
# $Id$
2c488f
# ----------------------------------------------------------------------
2c488f
993f6a
function texinfo_createStructure {
2c488f
2c488f
    # Verify manual base directory. The manual base directory is where
2c488f
    # the whole documentation manual is stored in. If it already
2c488f
    # exist, assume it was correctly created in the past.
2c488f
    if [[ -d $MANUAL_BASEDIR ]];then
2c488f
        return
2c488f
    fi
2c488f
420e77
    # Print action message.
2c488f
    cli_printMessage "-" --as-separator-line
2c488f
    cli_printMessage "`gettext "Creating manual structure."`"
2c488f
420e77
    # Create the language-specific directory used to store all files
420e77
    # related to documentation manual.
2c488f
    svn mkdir ${MANUAL_BASEDIR} --quiet
2c488f
420e77
    # Define file names required to build the manual.
420e77
    local FILE=''
420e77
    local FILES=$(cli_getFilesList "${MANUAL_TEMPLATE}" \
420e77
        --maxdepth='1' \
9fa13b
        --pattern="repository(-menu|-nodes|-index)?\.${MANUAL_EXTENSION}")
420e77
2c488f
    # Verify manual base file. The manual base file is where the
2c488f
    # documentation manual is defined in the backend format. Assuming
2c488f
    # no file exists (e.g., a new language-specific manual is being
420e77
    # created), use texinfo templates for it.
420e77
    for FILE in $FILES;do
420e77
        if [[ ! -f ${MANUAL_BASEDIR}/$(basename ${FILE}) ]];then
420e77
            cli_checkFiles ${FILE} -wn
420e77
            svn cp ${FILE} ${MANUAL_BASEDIR}/$(basename ${FILE}) --quiet
420e77
            cli_replaceTMarkers ${MANUAL_BASEDIR}/$(basename ${FILE})
2c488f
        fi
2c488f
    done
2c488f
2c488f
    # Update manual chapter related files.
448d34
    ${MANUAL_BACKEND}_createChapters
2c488f
2c488f
    # Update manual chapter related menu.
448d34
    ${MANUAL_BACKEND}_updateChaptersMenu
2c488f
2c488f
    # Update manual chapter related nodes (based on chapter related
2c488f
    # menu).
448d34
    ${MANUAL_BACKEND}_updateChaptersNodes
2c488f
2c488f
    # Commit changes from working copy to central repository only.  At
2c488f
    # this point, changes in the repository are not merged in the
2c488f
    # working copy, but chages in the working copy do are committed up
2c488f
    # to repository.
2c488f
    cli_commitRepoChanges ${MANUAL_BASEDIR}
2c488f
2c488f
}