#!/bin/csh ############################################################################### # This script takes a PS file and generates a WWW presentation # from it. Some settings in the beginning of this script might # need customizing. # # (c) Th. Proffen, 1999 ############################################################################### # Title, date and presenter(s) of the talk/presentation # (leave second author and email blank " " if required) ############################################################################### set title="Add title here" set when="Add date here" set where="Add location/department here" set by1="Add author 1 here" set mail1="(email: email1)" set by2="Add author 2 here" set mail2="(email: email2)" ############################################################################### # Table of contents: $toc contains the titles and $ntoc the starting # page number ! ############################################################################### set toc=("Entry 1" "Entry 2" "Entry 3" "...") set ntoc=(1 2 3 4) ############################################################################### # URL where 'Home' points to ############################################################################### set hurl="http://Home WWW page" ############################################################################### # Resolution for conversion PS to GIF in DPI ############################################################################### set res=60 ############################################################################### # Orientation - L=landscape, P=portrait (one entry per page !) ############################################################################### set orient=(P P L L P P P P P P P L L L L L L L L L L L L L L L L L) ############################################################################### # Nothing to change below here ############################################################################### if ($#argv != 1) then echo usage: ps2www psfile exit 1 endif set name=$1:r if (! -d $name.www) then mkdir $name.www echo Target directory $name.www created ... else echo Target directory $name.www already exists ... endif cd $name.www cp ../$1 . echo Compressing $1 ... gzip $1 set fsiz=`ls -l $1.gz` # Write home page rm -f $name.home.html cat << EOF > $name.home.html $title
Navigation


Home

Start


$title

by

$by1$mail1
$by2$mail2

$where
$when

EOF cat << EOF >> $name.home.html



Table of contents
    EOF @ itoc = 1 while ($itoc <= $#toc) cat << EOF >> $name.home.html
  • $toc[$itoc]
  • EOF @ itoc++ end cat << EOF >> $name.home.html

This presentation was created from $1.gz ($fsiz[5] bytes) on `date` ...

EOF echo Homepage $name.www/$name.home.html created ... echo Converting PS to GIF ... # Starting conversion ... gs -q -r$res -dBATCH -dNOPAUSE -dTextAlphaBits=4 -sDEVICE=ppmraw -sOutputFile=$name.%d.ppm ../$1 set files = `ls -rc $name.*.ppm` @ index = 1 while ($index <= $#files) rm -f $name.$index.html rm -f $name.$index.gif if ($orient[$index] == "L") then mv $files[$index] $$.ppm pnmflip -cw $$.ppm > $files[$index] rm $$.ppm endif echo "pnmcrop $files[$index] | ppmquant 255 - | ppmtogif - > $name.$index.gif" > $$ chmod +x $$ ./$$ >&/dev/null rm $$ $files[$index] @ prev = $index - 1 @ next = $index + 1 if ($prev <= 0) then @ prev = 1 endif if ($next > $#files) then @ next = $#files endif cat << EOF > $name.$index.html $title
Navigation


Previous

Contents

Next


Page: $index

EOF echo Done page $index ... @ index++ end rm -f index.html ln -s $name.home.html index.html echo Files are in $name.www ... echo Done ...