|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
1afa3c |
# texinfo_updateNodes.sh -- This function updates chapter's nodes
|
|
|
4c79b5 |
# definition using the chapter's menu as reference.
|
|
|
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_updateNodes {
|
|
|
4c79b5 |
|
|
|
858566 |
local TEXINFO_TEMPLATE=''
|
|
|
858566 |
|
|
|
66b6ae |
# Retrive nodes' entries from chapter-menu.texinfo file.
|
|
|
66b6ae |
local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${FLAG_BACKEND} \
|
|
|
4c79b5 |
| sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \
|
|
|
4c79b5 |
| egrep -v '^@(end )?menu$' | sed -r 's! !:!g' | sort | uniq)
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Re-build node structure based on menu information.
|
|
|
4c79b5 |
for NODE in $NODES;do
|
|
|
4c79b5 |
|
|
|
fa17ed |
NODE=$(echo "${NODE}" | sed -r 's!:! !g')
|
|
|
420e77 |
SECT=$(echo "${NODE}" | cut -d' ' -f2- | sed -r 's! !/!g')
|
|
|
420e77 |
INCL=$(echo "${NODE}" | sed -r 's! !/!g').${FLAG_BACKEND}
|
|
|
420e77 |
CIND=$(echo "${NODE}")
|
|
|
4c79b5 |
|
|
|
7d58ac |
# Create texinfo section file using templates, only if the
|
|
|
7d58ac |
# section file doesn't exist and hasn't been marked for
|
|
|
7d58ac |
# deletion. Otherwise, when the files have been marked for
|
|
|
7d58ac |
# deletion, they will be created again from texinfo template
|
|
|
7d58ac |
# to working copy and that might create confusion.
|
|
|
7d58ac |
if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]] \
|
|
|
7d58ac |
&& [[ $(cli_getRepoStatus ${MANUAL_BASEDIR}/$INCL) != 'D' ]];then
|
|
|
858566 |
|
|
|
858566 |
# Define what template to apply using the absolute path of
|
|
|
858566 |
# the documentation entry as reference.
|
|
|
420e77 |
if [[ ${MANUAL_BASEDIR}/${INCL} =~ 'trunk/Scripts/Functions/[[:alnum:]]+$' ]];then
|
|
|
420e77 |
TEXINFO_TEMPLATE="${MANUAL_TEMPLATE}/${MANUAL_CHAPTER_NAME}/section-functions.${FLAG_BACKEND}"
|
|
|
858566 |
else
|
|
|
420e77 |
TEXINFO_TEMPLATE="${MANUAL_TEMPLATE}/${MANUAL_CHAPTER_NAME}/section.${FLAG_BACKEND}"
|
|
|
858566 |
fi
|
|
|
858566 |
|
|
|
7d58ac |
# Verify texinfo template.
|
|
|
7d58ac |
cli_checkFiles $TEXINFO_TEMPLATE
|
|
|
7d58ac |
|
|
|
7d58ac |
# Copy texinfo template to its destination.
|
|
|
420e77 |
svn cp ${TEXINFO_TEMPLATE} ${MANUAL_BASEDIR}/$INCL --quiet
|
|
|
858566 |
|
|
|
858566 |
# Expand common translation markers.
|
|
|
858566 |
cli_replaceTMarkers "${MANUAL_BASEDIR}/$INCL"
|
|
|
858566 |
|
|
|
858566 |
# Expand texinfo-specific translation markers.
|
|
|
7d58ac |
${FLAG_BACKEND}_makeSeeAlso "${MANUAL_BASEDIR}/$INCL" "$NODE"
|
|
|
858566 |
|
|
|
4c79b5 |
fi
|
|
|
7d58ac |
|
|
|
4c79b5 |
# Output node information based on texinfo menu.
|
|
|
4c79b5 |
echo "@node $NODE"
|
|
|
fa17ed |
echo "@section `eval_gettext "The @file{\\\$SECT} Directory"`"
|
|
|
4c79b5 |
echo "@cindex $CIND"
|
|
|
4c79b5 |
echo "@include $INCL"
|
|
|
4c79b5 |
echo ""
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Dump node information into chapter node file.
|
|
|
66b6ae |
done > $MANUAL_CHAPTER_DIR/chapter-nodes.${FLAG_BACKEND}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|