- Add several mbcs and CP 932 functions, fix some existing calls
[wine/hacks.git] / documentation / db2html-winehq
blobbdb8fb084b7847290c9ee269da538c2e9ed0acde
1 #! /bin/sh
3 ## Customized version of db2html to make it easier to use alternate
4 ## stylesheets. Some versions of db2html support a '-d' option to
5 ## specify this, but not all. We'll explicitly specify that here.
6 ##
7 ## John R. Sheets <jsheets@codeweavers.com>
9 ## Other possible SGML stylesheets (default Debian versions...may be
10 ## different on other distributions).
11 #DB_STYLESHEET=/usr/lib/sgml/stylesheet/dsssl/docbook/cygnus/cygnus-both.dsl
12 #DB_STYLESHEET=/usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl
14 ## Use included default.dsl DSSSL stylesheet unless explicitly overridden with
15 ## the $WINEDOC_STYLESHEET envar.
17 ## NOTE: The invoked DSSSL stylesheet *MUST* have an HTML-specific section
18 ## in it; otherwise, jade will spew everything to stdout and fail to use
19 ## the stated stylesheet. Something like this:
21 ## <style-specification id="html" use="docbook">
22 if [ -z "$WINEDOC_STYLESHEET" ]; then
23 DB_STYLESHEET=../default.dsl
24 else
25 DB_STYLESHEET=$WINEDOC_STYLESHEET
28 output=db2html-dir
29 TMPDIR=DBTOHTML_OUTPUT_DIR$$
31 echo TMPDIR is $TMPDIR
33 echo "Using stylesheet: \"${DB_STYLESHEET}\""
35 if [ $# -gt 2 ]
36 then
37 echo "Usage: `basename $0` [filename.sgml]" >&2
38 exit 1
41 if [ $# -eq 1 ]
42 then
43 if [ ! -r $1 ]
44 then
45 echo Cannot read \"$1\". Exiting. >&2
46 exit 1
48 if echo $1 | egrep -i '\.sgml$|\.sgm$' >/dev/null 2>&1
49 then
50 # now make sure that the output directory is always a subdirectory
51 # of the current directory
52 echo
53 input_file=`basename $1`
54 output="`echo $input_file | sed 's,\.sgml$,,;s,\.sgm$,,'`"
55 echo "input file was called $input_file -- output will be in $output"
56 echo
60 mkdir $TMPDIR
61 SAVE_PWD=`pwd`
62 if [ $1 = `basename $1` ]; then
63 echo "working on ../$1"
64 (cd $TMPDIR; jade -t sgml -ihtml -d ${DB_STYLESHEET}\#html ../$1; cd $SAVE_PWD)
65 else
66 echo "working on $1"
67 (cd $TMPDIR; jade -t sgml -ihtml -d ${DB_STYLESHEET}\#html $1; cd $SAVE_PWD)
70 if [ $# -eq 1 ]
71 then
72 if [ -d ${output}.junk ]
73 then
74 /bin/rm -rf ${output}.junk
76 if [ -d ${output} ]
77 then
78 mv $output ${output}.junk
80 echo "about to rename temporary directory to $output"
81 mv ${TMPDIR} $output
82 else
83 cat $TMPDIR/*
86 rm -rf $TMPDIR
88 exit 0