|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
993f6a |
# texinfo_updateChaptersMenu.sh -- This function updates chapter menu.
|
|
|
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 |
|
|
|
dcd347 |
|
|
|
dcd347 |
|
|
|
fa95b1 |
#
|
|
|
74a058 |
|
|
|
74a058 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
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_updateChaptersMenu {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
local ACTION=$1
|
|
|
4c79b5 |
local MENUCHAPTERS=''
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
9b3e93 |
|
|
|
66b6ae |
|
|
|
9b3e93 |
|
|
|
9b3e93 |
|
|
|
9fa13b |
if [[ -f ${MANUAL_BASEFILE}-menu.${MANUAL_EXTENSION} ]];then
|
|
|
9fa13b |
MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.${MANUAL_EXTENSION} \
|
|
|
420e77 |
| egrep -v "^@(end )?menu$" | egrep -v '^\* Index::$')
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case $ACTION in
|
|
|
71101b |
|
|
|
4c79b5 |
'remove-entry' )
|
|
|
4c79b5 |
|
|
|
5285d6 |
MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \
|
|
|
7f7f8f |
| egrep -v "^\* ${MANUAL_CHAPTER_NAME}::[[:print:]]*$")
|
|
|
4c79b5 |
|
|
|
71101b |
|
|
|
4c79b5 |
'update-entry' | * )
|
|
|
4c79b5 |
|
|
|
5285d6 |
MENUCHAPTERS="${MENUCHAPTERS}
|
|
|
7f7f8f |
* ${MANUAL_CHAPTER_NAME}::"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
esac
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
5285d6 |
MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \
|
|
|
4c79b5 |
| egrep -v '^[[:space:]]*$')
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
9b3e93 |
MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sort | uniq)
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Give format to final menu output.
|
|
|
4c79b5 |
MENUCHAPTERS="@menu
|
|
|
5285d6 |
${MENUCHAPTERS}
|
|
|
5285d6 |
* Index::
|
|
|
4c79b5 |
@end menu"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
5285d6 |
MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \
|
|
|
4c79b5 |
| egrep -v '^[[:space:]]*$')
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
9fa13b |
echo "${MENUCHAPTERS}" > ${MANUAL_BASEFILE}-menu.${MANUAL_EXTENSION}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|