# !/bin/sh

SRC=$1
BASE=${SRC%.xml}
WORKDIR=./${BASE}.html

XMLDCL=/opt/jade/share/xml.dcl
DB_STYLESHEET=manual-both.dsl

if [ ! -r $SRC ]
then
  echo Cannot read \"$SRC\".  Exiting. >&2
  exit 1
fi

mkdir -p $WORKDIR
rm -f $WORKDIR/*.html

SAVE_PWD=`pwd`
echo "working on ../$SRC"
(cd $WORKDIR; jade -t sgml -ihtml -d ../${DB_STYLESHEET}\#html $XMLDCL ../$SRC; \
../fixfigs.sh; cd $SAVE_PWD)

exit 0
