5a9b54
#! /bin/sh
5a9b54
5a9b54
ADMON_GRAPHICS=/usr/share/sgml/docbook/dsssl-stylesheets/images/*.gif
5a9b54
5a9b54
output=docbook2html-dir
5a9b54
skip=0
5a9b54
dbdircleanup=1
5a9b54
outputdone=0
5a9b54
for arg in "$@"
5a9b54
do
5a9b54
  if [ $skip -gt 0 ]
5a9b54
  then
5a9b54
    skip=$(($skip - 1))
5a9b54
    continue
5a9b54
  fi
5a9b54
  case $arg in
5a9b54
  -h|--help|-v|--version)	break
5a9b54
				;;
5a9b54
  -n|--nostd|-u|--nochunks)	;;
5a9b54
  -o|--output)   outputdone=1
5a9b54
	         ;;
5a9b54
5a9b54
  -*)				skip=1
5a9b54
				;;
5a9b54
  *)    dbdircleanup=0
5a9b54
        if [ ${outputdone} -eq 1 ];
5a9b54
        then
5a9b54
          output="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,')"
5a9b54
          outputfile="$basename "$output""
5a9b54
          outputdone=2
5a9b54
        elif [ ${outputdone} -eq 2 ];
5a9b54
        then
5a9b54
          outputfile="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,' | \
5a9b54
                      rev | cut -d'/' -f1 | rev)"
5a9b54
        else
5a9b54
          output="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,')"
5a9b54
          outputfile=$(basename "$output")
5a9b54
        fi
5a9b54
	;;
5a9b54
  esac
5a9b54
done
5a9b54
5a9b54
if [ ${dbdircleanup} -eq 0 ];
5a9b54
then
5a9b54
  echo "Output is $output/$outputfile.html"
5a9b54
fi
5a9b54
if [ -d ${output} ]
5a9b54
then
5a9b54
  rm -rf ${output}.junk
5a9b54
  mv ${output} ${output}.junk
5a9b54
fi
5a9b54
mkdir ${output}
5a9b54
mkdir ${output}/stylesheet-images
5a9b54
cp ${ADMON_GRAPHICS} ${output}/stylesheet-images
5a9b54
jw -f docbook -b html -o ${output} "$@"
5a9b54
if [ ${dbdircleanup} -eq 1 ];
5a9b54
then
5a9b54
  rm -rf ${output}
5a9b54
fi