| 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 xhtml 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/xhtml_links.sh |
| 35 |
config="$basedir/formats/psiconv.conf" |
| 36 |
|
| 37 |
|
| 38 |
echo "Going to create the intermediate files..." |
| 39 |
rm -rf $tempdir |
| 40 |
mkdir $tempdir |
| 41 |
for file in "$@"; do |
| 42 |
echo "Going to process $file..." |
| 43 |
outputfile=$tempdir/`basename $file|sed s,'.psi$','.html,'` |
| 44 |
echo $libtool --mode=execute $psiconv -c $config -o $outputfile -Txhtml -eASCII $file |
| 45 |
$libtool --mode=execute $psiconv -c $config -o $outputfile -Txhtml -eASCII $file |
| 46 |
done |
| 47 |
|
| 48 |
echo "Going to produce the index..." |
| 49 |
( |
| 50 |
cd $tempdir |
| 51 |
files= |
| 52 |
for file in "$@"; do |
| 53 |
files="$files `basename $file|sed s,'.psi$','.html',`" |
| 54 |
done |
| 55 |
$mkindex $index $files |
| 56 |
) |
| 57 |
|
| 58 |
echo "Going to produce the final files..." |
| 59 |
for file in "$@"; do |
| 60 |
echo "Going to process $file..." |
| 61 |
inputfile=$tempdir/`basename $file|sed s,'.psi$','.html,'` |
| 62 |
outputfile=$outputdir/`basename $file|sed s,'.psi$','.html,'` |
| 63 |
rm -f $outputfile |
| 64 |
echo $mkdef $index $inputfile \> $outputfile |
| 65 |
$mkdef $index $inputfile > $outputfile |
| 66 |
done |