|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# docbook_prepareStyles.sh -- This function prepares styles' final
|
|
|
878a2b |
# instances used in transformations based on XSL or DSL templates.
|
|
|
878a2b |
|
|
|
04642d |
# need to be expanded before they can be used for transformations.
|
|
|
04642d |
# This function creates temporal instances of XSL and DSL templates
|
|
|
04642d |
# with translation markers expanded inside so as for transformation
|
|
|
878a2b |
# commands (e.g., `xmltproc' or `openjade' through `docbook2pdf') to
|
|
|
878a2b |
# use as style defintion.
|
|
|
878a2b |
#
|
|
|
03486a |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function docbook_prepareStyles {
|
|
|
878a2b |
|
|
|
878a2b |
local STYLE_TEMPLATE_FILE=''
|
|
|
878a2b |
local STYLE_TEMPLATE_FILES=$@
|
|
|
878a2b |
local STYLE_INSTANCE_COMMON=''
|
|
|
878a2b |
local COUNT=0
|
|
|
878a2b |
|
|
|
878a2b |
for STYLE_TEMPLATE_FILE in $STYLE_TEMPLATE_FILES;do
|
|
|
878a2b |
|
|
|
878a2b |
STYLE_TEMPLATE[((++${#STYLE_TEMPLATE[*]}))]="${STYLE_TEMPLATE_FILE}"
|
|
|
878a2b |
STYLE_INSTANCE[((++${#STYLE_INSTANCE[*]}))]="$(cli_getTemporalFile ${STYLE_TEMPLATE_FILE})"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
COUNT=$(( ${
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
cp ${STYLE_TEMPLATE[$COUNT]} ${STYLE_INSTANCE[$COUNT]}
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
if [[ $STYLE_TEMPLATE_FILE =~ 'docbook2fo\.xsl$' ]];then
|
|
|
878a2b |
STYLE_INSTANCE_FINAL=${STYLE_INSTANCE[$COUNT]}
|
|
|
878a2b |
elif [[ $STYLE_TEMPLATE_FILE =~ 'docbook2pdf\.dsl$' ]];then
|
|
|
878a2b |
STYLE_INSTANCE_FINAL=${STYLE_INSTANCE[${COUNT}]}
|
|
|
878a2b |
elif [[ $STYLE_TEMPLATE_FILE =~ 'docbook2xhtml-(chunks|single)\.xsl$' ]];then
|
|
|
878a2b |
STYLE_INSTANCE_FINAL=${STYLE_INSTANCE[${COUNT}]}
|
|
|
878a2b |
elif [[ $STYLE_TEMPLATE_FILE =~ 'docbook2xhtml-common\.xsl$' ]];then
|
|
|
878a2b |
STYLE_INSTANCE_COMMON=${STYLE_INSTANCE[${COUNT}]}
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
c5b339 |
cli_checkFiles -e $STYLE_INSTANCE_FINAL
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# if it exists.
|
|
|
878a2b |
if [[ -f $STYLE_INSTANCE_COMMON ]];then
|
|
|
878a2b |
cli_expandTMarkers $STYLE_INSTANCE_COMMON
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
sed -r -i "s!=STYLE_XHTML_COMMON=!${STYLE_INSTANCE_COMMON}!" ${STYLE_INSTANCE_FINAL}
|
|
|
878a2b |
|
|
|
878a2b |
}
|