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

4c79b5
#!/bin/bash
4c79b5
#
993f6a
# texinfo_createChapters.sh -- This function creates the chapters'
63835d
# base directory structure using templates as reference.
4c79b5
#
3b0984
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
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
993f6a
function texinfo_createChapters {
4c79b5
7dd15a
    local MANUAL_CHAPTER_NAME=''
4c79b5
34f2ab
    # Define list of chapter templates files used as base to create
34f2ab
    # the chapters' documentation manual.
34f2ab
    local FILE=''
6150a1
    local FILES=$(cli_getFilesList ${MANUAL_TEMPLATE_L10N} \
420e77
        --pattern='chapter(-menu|-nodes)?\.texinfo' --mindepth='2')
4c79b5
34f2ab
    # Loop through chapter structures and create them.
34f2ab
    for FILE in $FILES;do
4c79b5
34f2ab
        # Redefine chapter directory based on template files.
7dd15a
        MANUAL_CHAPTER_NAME=$(basename $(dirname ${FILE}))
4c79b5
34f2ab
        # Verify texinfo templates used as based to build the chapter.
34f2ab
        # Be sure they are inside the working copy of CentOS Artwork
34f2ab
        # Repository (-w) and under version control (-n), too.
34f2ab
        cli_checkFiles ${FILE} -wn
34f2ab
34f2ab
        # Verify chapter's directory. If it doesn't exist, create it.
7dd15a
        if [[ ! -d ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} ]];then
7dd15a
            svn mkdir ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} --quiet
34f2ab
        fi
34f2ab
34f2ab
        # Copy template files into chapter's directory.
7dd15a
        svn cp ${FILE} ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} --quiet
7dd15a
7dd15a
        # Remove content from `chapter-nodes.texinfo' instance to
7dd15a
        # start with a clean node structure. This file is also used by
7dd15a
        # to create new repository documentation entries, but we don't
7dd15a
        # need that information right now (when the `Directories'
7dd15a
        # chapter structure is created), just an empty copy of the
7dd15a
        # file. The node structure of `Directories' chapter is created
7dd15a
        # automatically based on repository directory structure.
7dd15a
        if [[ $FILE =~ "Directories/chapter-nodes\.texinfo$" ]];then
9fa13b
            echo "" > ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME}/chapter-nodes.${MANUAL_EXTENSION}
7dd15a
        fi
34f2ab
34f2ab
    done
5285d6
4c79b5
}