2000-12-13 22:52:37 +01:00
|
|
|
#! /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 <jsheets@codeweavers.com>
|
|
|
|
|
2001-01-19 00:07:53 +01:00
|
|
|
## The DocBook installations behave differently for the various Linux
|
|
|
|
## distributions. Try to make some sense out of it all....
|
|
|
|
##
|
|
|
|
## $LINUXDIST holds the name of the distribution
|
|
|
|
## $JADETAG adds "/#html" to the stylesheet-specification in the Jade
|
|
|
|
## command line (see comments below), if necessary for that dist.
|
|
|
|
if [ -a /etc/debian_version ]; then
|
|
|
|
LINUXDIST="Debian"
|
|
|
|
JADETAG=\#html
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -a /etc/redhat_release ]; then
|
|
|
|
LINUXDIST="Redhat"
|
|
|
|
JADETAG=
|
|
|
|
fi
|
|
|
|
|
|
|
|
## FIXME: Add more distributions here...
|
|
|
|
|
|
|
|
if [ -n "$LINUXDIST" ]; then
|
|
|
|
echo "Using db2html parameters for a $LINUXDIST Linux distribution..."
|
|
|
|
fi
|
2000-12-13 22:52:37 +01:00
|
|
|
|
|
|
|
## 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:
|
|
|
|
##
|
|
|
|
## <style-specification id="html" use="docbook">
|
|
|
|
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
|
|
|
|
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
|
2001-01-19 00:07:53 +01:00
|
|
|
EXTRA_PATH=../
|
2000-12-13 22:52:37 +01:00
|
|
|
else
|
2001-01-19 00:07:53 +01:00
|
|
|
EXTRA_PATH=
|
2000-12-13 22:52:37 +01:00
|
|
|
fi
|
|
|
|
|
2001-01-19 00:07:53 +01:00
|
|
|
JADE_CMD="jade -t sgml -ihtml -d ${DB_STYLESHEET}${JADETAG} ${EXTRA_PATH}$1"
|
|
|
|
echo "Invoking command '$JADE_CMD'"
|
|
|
|
echo
|
|
|
|
|
|
|
|
echo "working on ${EXTRA_PATH}$1"
|
|
|
|
(cd $TMPDIR; $JADE_CMD; cd $SAVE_PWD)
|
|
|
|
|
2000-12-13 22:52:37 +01:00
|
|
|
if [ $# -eq 1 ]
|
|
|
|
then
|
2001-11-25 01:51:36 +01:00
|
|
|
if [ -d "${output}.junk" ]
|
2000-12-13 22:52:37 +01:00
|
|
|
then
|
2001-11-25 01:51:36 +01:00
|
|
|
/bin/rm -rf "${output}.junk"
|
2000-12-13 22:52:37 +01:00
|
|
|
fi
|
2001-11-25 01:51:36 +01:00
|
|
|
if [ -d "${output}" ]
|
2000-12-13 22:52:37 +01:00
|
|
|
then
|
2001-11-25 01:51:36 +01:00
|
|
|
mv "$output" "${output}.junk"
|
2000-12-13 22:52:37 +01:00
|
|
|
fi
|
|
|
|
echo "about to rename temporary directory to $output"
|
2001-11-25 01:51:36 +01:00
|
|
|
mv "${TMPDIR}" "$output"
|
2000-12-13 22:52:37 +01:00
|
|
|
else
|
2001-11-25 01:51:36 +01:00
|
|
|
cat "$TMPDIR"/*
|
2000-12-13 22:52:37 +01:00
|
|
|
fi
|
|
|
|
|
2001-11-25 01:51:36 +01:00
|
|
|
rm -rf "$TMPDIR"
|
2000-12-13 22:52:37 +01:00
|
|
|
|
|
|
|
exit 0
|