|
|
858566 |
#!/bin/bash
|
|
|
858566 |
#
|
|
|
0cf442 |
# texinfo_makeSeeAlso.sh -- This function creates a menu with all
|
|
|
a4b2d6 |
# section entries found one level ahead from the current node
|
|
|
0cf442 |
# information. The texinfo code of this menu is expanded wherever a
|
|
|
0cf442 |
# `@menu...@end menu' definition be found inside a section entry.
|
|
|
0cf442 |
# When no menu definition is found, nothing is expanded.
|
|
|
858566 |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
858566 |
#
|
|
|
858566 |
# This program is free software; you can redistribute it and/or modify
|
|
|
858566 |
# it under the terms of the GNU General Public License as published by
|
|
|
858566 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
858566 |
# your option) any later version.
|
|
|
858566 |
#
|
|
|
858566 |
# This program is distributed in the hope that it will be useful, but
|
|
|
858566 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
858566 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
858566 |
# General Public License for more details.
|
|
|
858566 |
#
|
|
|
858566 |
# You should have received a copy of the GNU General Public License
|
|
|
858566 |
# along with this program; if not, write to the Free Software
|
|
|
858566 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
858566 |
#
|
|
|
858566 |
# ----------------------------------------------------------------------
|
|
|
858566 |
# $Id$
|
|
|
858566 |
# ----------------------------------------------------------------------
|
|
|
858566 |
|
|
|
993f6a |
function texinfo_makeSeeAlso {
|
|
|
858566 |
|
|
|
0cf442 |
local MENU=''
|
|
|
0cf442 |
local MENUNODES=''
|
|
|
0cf442 |
local CHILD_ENTRY=''
|
|
|
0cf442 |
local CHILD_ENTRIES=''
|
|
|
858566 |
|
|
|
0cf442 |
# Initialize section definition absolute path.
|
|
|
0cf442 |
local MANUAL_ENTRY="$1"
|
|
|
0cf442 |
|
|
|
385e60 |
# Verify section entry. When section entries are deleted, there is
|
|
|
385e60 |
# no menu definition to set.
|
|
|
385e60 |
if [[ ! -f $MANUAL_ENTRY ]];then
|
|
|
385e60 |
return
|
|
|
385e60 |
fi
|
|
|
385e60 |
|
|
|
0cf442 |
# Define pattern used to build list of child sections. A child
|
|
|
0cf442 |
# section shares the same path information of its parent with out
|
|
|
0cf442 |
# file extension. For example, if you have the `identity',
|
|
|
0cf442 |
# `identity-images' and `identity-images-themes' section entries,
|
|
|
0cf442 |
# `identity-images' is a child entry of `identity' likewise
|
|
|
0cf442 |
# `identity-images-themes' is a child entry of `identity-images'.
|
|
|
0cf442 |
local PATTERN="$(echo $MANUAL_ENTRY | sed -r "s/\.${MANUAL_EXTENSION}$//")"
|
|
|
858566 |
|
|
|
dfb5a3 |
# Define list of child entries we'll use as reference to build the
|
|
|
dfb5a3 |
# menu nodes. Reverse the output here to produce the correct value
|
|
|
dfb5a3 |
# based on menu nodes definition set further.
|
|
|
3e2cce |
local CHILD_ENTRIES=$(cli_getFilesList $(dirname ${MANUAL_ENTRY}) \
|
|
|
0cf442 |
--pattern="${PATTERN}-[[:alnum:]]+\.${MANUAL_EXTENSION}" | sort -r | uniq )
|
|
|
858566 |
|
|
|
0cf442 |
# Define menu nodes using section entries as reference.
|
|
|
0cf442 |
for CHILD_ENTRY in $CHILD_ENTRIES;do
|
|
|
0cf442 |
MENUNODES="* $(${FLAG_BACKEND}_getEntryNode "$CHILD_ENTRY")::\n${MENUNODES}"
|
|
|
0cf442 |
done
|
|
|
858566 |
|
|
|
0cf442 |
# Define menu using menu nodes.
|
|
|
0cf442 |
MENU="@menu\n${MENUNODES}@end menu"
|
|
|
858566 |
|
|
|
0cf442 |
# Expand menu definition using translation marker or menu
|
|
|
0cf442 |
# definition itself.
|
|
|
0cf442 |
sed -r -i "/^@menu$/,/^@end menu$/c\\${MENU}" $MANUAL_ENTRY
|
|
|
0cf442 |
|
|
|
858566 |
}
|