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

2c488f
#!/bin/bash
2c488f
#
2c488f
# texinfo_createStructure.sh -- This function creates the
2c488f
# documentation structure of a manual using the current language as
2c488f
# reference.
2c488f
#
2c488f
# Copyright (C) 2009, 2010, 2011 The CentOS Project
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
2c488f
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
2c488f
    # Print confirmation question.
2c488f
    cli_printMessage "-" --as-separator-line
2c488f
    cli_printMessage "`gettext "Creating manual structure."`"
2c488f
2c488f
    # Define file names required to build the manual.
2c488f
    local MANUAL_FILE=''
2c488f
    local MANUAL_FILES="${MANUAL_NAME}.${FLAG_BACKEND}
2c488f
        ${MANUAL_NAME}-nodes.${FLAG_BACKEND}
2c488f
        ${MANUAL_NAME}-menu.${FLAG_BACKEND}"
2c488f
2c488f
    # Notify that a new directory for a language-specific
2c488f
    # documentation manual will be created.
2c488f
    svn mkdir ${MANUAL_BASEDIR} --quiet
2c488f
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
2c488f
    # created), use texinfo templates to create it.
2c488f
    for MANUAL_FILE in $MANUAL_FILES;do
2c488f
        if [[ ! -f ${MANUAL_BASEDIR}/${MANUAL_FILE} ]];then
2c488f
            cli_checkFiles ${MANUAL_TEMPLATE}/${MANUAL_FILE} -wn
2c488f
            svn cp ${MANUAL_TEMPLATE}/${MANUAL_FILE} ${MANUAL_BASEDIR}/${MANUAL_FILE} --quiet
2c488f
            cli_replaceTMarkers ${MANUAL_BASEDIR}/${MANUAL_FILE}
2c488f
        fi
2c488f
    done
2c488f
2c488f
    # Update manual chapter related files.
2c488f
    ${FLAG_BACKEND}_updateChaptersFiles
2c488f
2c488f
    # Update manual chapter related menu.
2c488f
    ${FLAG_BACKEND}_updateChaptersMenu
2c488f
2c488f
    # Update manual chapter related nodes (based on chapter related
2c488f
    # menu).
2c488f
    ${FLAG_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
}