libreccm-legacy/ccm-iaw-aplaws/doc/docs-stuff/db2indexed-training-pdf

55 lines
1014 B
Bash
Executable File

#! /bin/sh
# Make sure we have an absolute path to the backend and stylesheet, as
# jw doesn't like relative paths...
STUFFPATH=`dirname $0`
if [ -n "${STUFFPATH##/*}" ]
then
STUFFPATH=$PWD/$STUFFPATH
fi
#
#Grab name of the SGML file without extension
#
O_OPTION=0
for i in "$@"
do
if [ $O_OPTION = "1" ]
then
FILENAME=$i
O_OPTION=0
fi
if [ $i = "-o" ]
then
O_OPTION=1
fi
done
if [ -z $FILENAME ]
then
# Grab name of the SGML file...
FILENAME="`echo $i | sed 's,\.sgml$,,;s,\.sgm$,,'`"
fi
# Generate index
jw -f docbook \
-b $STUFFPATH/index \
-d $STUFFPATH/stylesheets/redhat-training.dsl#html \
-o $FILENAME-tmp \
$*
# Generate PDF with generated index
jw -f docbook \
-b $STUFFPATH/indexed-training-pdf \
-d $STUFFPATH/stylesheets/redhat-training.dsl#print \
$*
# Remove temp directory
echo -n Removing temp directory $PWD/$FILENAME-tmp...
rm -rf $PWD/$FILENAME-tmp
echo Done!