#! /bin/sh ## Customized version of db2html to make it easier to use alternate ## stylesheets. Some versions of db2html support a '-d' option to ## specify this, but not all. We'll explicitly specify that here. ## ## John R. Sheets ## Other possible SGML stylesheets (default Debian versions...may be ## different on other distributions). #DB_STYLESHEET=/usr/lib/sgml/stylesheet/dsssl/docbook/cygnus/cygnus-both.dsl #DB_STYLESHEET=/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl ## Use included default.dsl DSSSL stylesheet unless explicitly overridden with ## the $WINEDOC_STYLESHEET envar. ## ## NOTE: The invoked DSSSL stylesheet *MUST* have an HTML-specific section ## in it; otherwise, jade will spew everything to stdout and fail to use ## the stated stylesheet. Something like this: ## ## if [ -z "$WINEDOC_STYLESHEET" ]; then DB_STYLESHEET=../default.dsl else DB_STYLESHEET=$WINEDOC_STYLESHEET fi output=db2html-dir TMPDIR=DBTOHTML_OUTPUT_DIR$$ echo TMPDIR is $TMPDIR echo "Using stylesheet: \"${DB_STYLESHEET}\"" if [ $# -gt 2 ] then echo "Usage: `basename $0` [filename.sgml]" >&2 exit 1 fi if [ $# -eq 1 ] then if [ ! -r $1 ] then echo Cannot read \"$1\". Exiting. >&2 exit 1 fi if echo $1 | egrep -i '\.sgml$|\.sgm$' >/dev/null 2>&1 then # now make sure that the output directory is always a subdirectory # of the current directory echo input_file=`basename $1` output="`echo $input_file | sed 's,\.sgml$,,;s,\.sgm$,,'`" echo "input file was called $input_file -- output will be in $output" echo fi fi mkdir $TMPDIR SAVE_PWD=`pwd` if [ $1 = `basename $1` ]; then echo "working on ../$1" (cd $TMPDIR; jade -t sgml -ihtml -d ${DB_STYLESHEET}\#html ../$1; cd $SAVE_PWD) else echo "working on $1" (cd $TMPDIR; jade -t sgml -ihtml -d ${DB_STYLESHEET}\#html $1; cd $SAVE_PWD) fi if [ $# -eq 1 ] then if [ -d ${output}.junk ] then /bin/rm -rf ${output}.junk fi if [ -d ${output} ] then mv $output ${output}.junk fi echo "about to rename temporary directory to $output" mv ${TMPDIR} $output else cat $TMPDIR/* fi rm -rf $TMPDIR exit 0