1 |
#! /bin/sh |
2 |
|
3 |
# Work around a BASH bug (prints a directory even in a non-interactive shell) |
4 |
unset CDPATH |
5 |
|
6 |
if test "$#" -lt 3 ; then |
7 |
echo "Syntax: $0 psiconv_dir output_dir files..." |
8 |
exit 1 |
9 |
fi |
10 |
|
11 |
if ! test -d "$1"/program/psiconv ; then |
12 |
echo "First parameter should be base psiconv directory!" |
13 |
exit 1 |
14 |
fi |
15 |
basedir=`cd $1; pwd` |
16 |
|
17 |
if ! test -d "$2" ; then |
18 |
echo "Output directory does not exist!" |
19 |
exit 1 |
20 |
fi |
21 |
outputdir=`cd $2; pwd` |
22 |
|
23 |
|
24 |
shift |
25 |
shift |
26 |
echo "Generating html4 docs..." |
27 |
|
28 |
libtool=$basedir/libtool |
29 |
psiconv=$basedir/program/psiconv/psiconv |
30 |
indexfile=$outputdir/index |
31 |
tempdir=$outputdir/.temp |
32 |
mkindex=$basedir/formats/index_html.sh |
33 |
index=$tempdir/index |
34 |
mkdef=$basedir/formats/html4_links.sh |
35 |
|
36 |
|
37 |
echo "Going to create the intermediate files..." |
38 |
rm -rf $tempdir |
39 |
mkdir $tempdir |
40 |
for file in "$@"; do |
41 |
echo "Going to process $file..." |
42 |
outputfile=$tempdir/`basename $file|sed s,'.psi$','.html,'` |
43 |
echo $libtool --mode=execute $psiconv -o $outputfile -Thtml4 -eASCII $file |
44 |
$libtool --mode=execute $psiconv -o $outputfile -Thtml4 -eASCII $file |
45 |
done |
46 |
|
47 |
echo "Going to produce the index..." |
48 |
( |
49 |
cd $tempdir |
50 |
files= |
51 |
for file in "$@"; do |
52 |
files="$files `basename $file|sed s,'.psi$','.html',`" |
53 |
done |
54 |
$mkindex $index $files |
55 |
) |
56 |
|
57 |
echo "Going to produce the final files..." |
58 |
for file in "$@"; do |
59 |
echo "Going to process $file..." |
60 |
inputfile=$tempdir/`basename $file|sed s,'.psi$','.html,'` |
61 |
outputfile=$outputdir/`basename $file|sed s,'.psi$','.html,'` |
62 |
rm -f $outputfile |
63 |
echo $mkdef $index $inputfile \> $outputfile |
64 |
$mkdef $index $inputfile > $outputfile |
65 |
done |