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

4c79b5
#!/bin/bash
4c79b5
#
d92dde
# texinfo_updateChapterNodes.sh -- This function updates nodes of
4c79b5
# chapters based on menu of chapters.
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
d92dde
function texinfo_updateChapterNodes {
4c79b5
edaa9d
    # Build chapter nodes using entries from chapter menu as
edaa9d
    # reference. Don't include `Licenses' or `Index' chapters here.
edaa9d
    # These chapters are part of our manual's main defintion file and
edaa9d
    # shouldn't be handled as regular chapters.
9fa13b
    local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.${MANUAL_EXTENSION} \
edaa9d
        | egrep -v '^@(end )?menu$' | egrep -v '^\* (Licenses|Index)::$'\
4c79b5
        | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \
edaa9d
        | sed -r 's! !_!g')
4c79b5
edaa9d
    # Build list of inclusions from chapter nodes. 
4c79b5
    local FILENODE=$(\
420e77
        for CHAPTERNODE in ${CHAPTERNODES};do
420e77
            INCL=$(echo ${CHAPTERNODE} \
9fa13b
                | sed -r "s!(${CHAPTERNODE})!\1/chapter\.${MANUAL_EXTENSION}!")
420e77
            # Output inclusion line using texinfo format.
420e77
            echo "@include $INCL"
420e77
        done)
4c79b5
4c79b5
    # Dump organized nodes of chapters into file.
9fa13b
    echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.${MANUAL_EXTENSION}
4c79b5
4c79b5
}