|
|
31e68d |
#!/bin/bash
|
|
|
31e68d |
#
|
|
|
31e68d |
# docbook_getEntry.sh -- This function builds a documentation entry
|
|
|
31e68d |
# based on a location specified. Location specification can be both
|
|
|
31e68d |
# action value (ACTIONVAL) variable or a value passed as first
|
|
|
31e68d |
# positional parameter.
|
|
|
31e68d |
#
|
|
|
31e68d |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
31e68d |
#
|
|
|
31e68d |
# This program is free software; you can redistribute it and/or modify
|
|
|
31e68d |
# it under the terms of the GNU General Public License as published by
|
|
|
31e68d |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
31e68d |
# your option) any later version.
|
|
|
31e68d |
#
|
|
|
31e68d |
# This program is distributed in the hope that it will be useful, but
|
|
|
31e68d |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
31e68d |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
31e68d |
# General Public License for more details.
|
|
|
31e68d |
#
|
|
|
31e68d |
# You should have received a copy of the GNU General Public License
|
|
|
31e68d |
# along with this program; if not, write to the Free Software
|
|
|
31e68d |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
31e68d |
#
|
|
|
31e68d |
# ----------------------------------------------------------------------
|
|
|
31e68d |
# $Id$
|
|
|
31e68d |
# ----------------------------------------------------------------------
|
|
|
31e68d |
|
|
|
31e68d |
function docbook_getEntry {
|
|
|
31e68d |
|
|
|
31e68d |
# Define variables as local to avoid conflicts outside.
|
|
|
31e68d |
local ENTRY=''
|
|
|
31e68d |
local LOCATION=''
|
|
|
31e68d |
|
|
|
31e68d |
# Redefine location in order to make this function reusable not
|
|
|
31e68d |
# just for action value variable but whatever value passed as
|
|
|
31e68d |
# first possitional argument.
|
|
|
31e68d |
if [[ "$1" != '' ]];then
|
|
|
31e68d |
LOCATION="$1"
|
|
|
31e68d |
else
|
|
|
31e68d |
LOCATION="$ACTIONVAL"
|
|
|
31e68d |
fi
|
|
|
31e68d |
|
|
|
31e68d |
# Define relative path of entry, from trunk directory on.
|
|
|
31e68d |
ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!")
|
|
|
31e68d |
|
|
|
31e68d |
# Verify the entry relative path to find out which documentation
|
|
|
31e68d |
# manual we are acting on. As convenction, whatever documentation
|
|
|
31e68d |
# entry you provide outside trunk/Manuals/ directory structure is
|
|
|
31e68d |
# considered as you are documenting the repository directory
|
|
|
31e68d |
# structure. Otherwise, if an entry inside trunk/Manuals/ is
|
|
|
31e68d |
# provided, the directory structure provided is used as default
|
|
|
31e68d |
# documentation manual.
|
|
|
31e68d |
if [[ ${ENTRY} =~ "\.docbook$" ]];then
|
|
|
31e68d |
ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manuals/Docbook/!!')
|
|
|
31e68d |
else
|
|
|
31e68d |
ENTRY=$(dirname Entities/Repository/Directories/${ENTRY})/$(basename $LOCATION).docbook
|
|
|
31e68d |
fi
|
|
|
31e68d |
|
|
|
31e68d |
# Re-define entry to set absolute path to manuals base directory
|
|
|
31e68d |
# structure.
|
|
|
31e68d |
ENTRY=${MANUAL_BASEDIR}/${ENTRY}
|
|
|
31e68d |
|
|
|
31e68d |
# Output entry's absolute path.
|
|
|
31e68d |
echo ${ENTRY}
|
|
|
31e68d |
|
|
|
31e68d |
}
|