|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
42939a |
# texinfo_getEntry.sh -- This function builds a documentation entry
|
|
|
42939a |
# based on a location specified. Location specification can be both
|
|
|
42939a |
# action value (ACTIONVAL) variable or a value passed as first
|
|
|
42939a |
# positional parameter.
|
|
|
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 |
|
|
|
42939a |
function texinfo_getEntry {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define variables as local to avoid conflicts outside.
|
|
|
071959 |
local MANUAL_ENTRY=''
|
|
|
638bf8 |
local LOCATION=''
|
|
|
1f4dd5 |
local LOCATIONS=''
|
|
|
638bf8 |
|
|
|
1f4dd5 |
# Redefine locations in order to make this function reusable not
|
|
|
638bf8 |
# just for action value variable but whatever value passed as
|
|
|
638bf8 |
# first possitional argument.
|
|
|
40e4a4 |
if [[ "$@" != '' ]];then
|
|
|
40e4a4 |
LOCATIONS="$@"
|
|
|
638bf8 |
else
|
|
|
1f4dd5 |
LOCATIONS="$ACTIONVAL"
|
|
|
638bf8 |
fi
|
|
|
4c79b5 |
|
|
|
1f4dd5 |
for LOCATION in $LOCATIONS;do
|
|
|
b45dde |
|
|
|
b45dde |
# Sanitate action value to use absolute paths.
|
|
|
420e77 |
LOCATION=$(cli_checkRepoDirSource $LOCATION)
|
|
|
1f4dd5 |
|
|
|
1f4dd5 |
# Define relative path of entry, from trunk directory on.
|
|
|
071959 |
MANUAL_ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!")
|
|
|
4c79b5 |
|
|
|
1f4dd5 |
# Verify the entry relative path to find out which
|
|
|
1f4dd5 |
# documentation manual we are acting on. As convenction,
|
|
|
1f4dd5 |
# whatever documentation entry you provide outside
|
|
|
1f4dd5 |
# trunk/Manuals/ directory structure is considered as you are
|
|
|
1f4dd5 |
# documenting the repository directory structure. Otherwise,
|
|
|
1f4dd5 |
# if an entry inside trunk/Manuals/ is provided, the directory
|
|
|
1f4dd5 |
# structure provided is used as default documentation manual.
|
|
|
071959 |
if [[ ${MANUAL_ENTRY} =~ "\.${FLAG_BACKEND}$" ]];then
|
|
|
071959 |
MANUAL_ENTRY=$(echo ${MANUAL_ENTRY} | sed "s!trunk/Manuals/$(cli_getRepoName ${FLAG_BACKEND} -d)/!!")
|
|
|
1f4dd5 |
else
|
|
|
420e77 |
MANUAL_ENTRY=$(dirname ${MANUAL_CHAPTER_NAME}/${MANUAL_ENTRY})/$(basename $LOCATION).${FLAG_BACKEND}
|
|
|
1f4dd5 |
fi
|
|
|
1f4dd5 |
|
|
|
1f4dd5 |
# Re-define entry to set absolute path to manuals base
|
|
|
1f4dd5 |
# directory structure.
|
|
|
071959 |
MANUAL_ENTRY=${MANUAL_BASEDIR}/${MANUAL_ENTRY}
|
|
|
4c79b5 |
|
|
|
1f4dd5 |
# Output entry's absolute path.
|
|
|
071959 |
echo ${MANUAL_ENTRY}
|
|
|
4c79b5 |
|
|
|
1f4dd5 |
done
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|