#!/bin/sh
./makedoc
[ ! -f cdo.pdf ] && ./makepdf
[ ! -f cdo_refcard.pdf ] && ./makerefcard
[ ! -f cdo_eca.pdf ] && ./makepdfeca
[ ! -f cdo_magics.pdf ] && ./makepdfmagics

if [ ! -d ../html ];then mkdir ../html ;fi
htlatex cdo.tex "html" "" -d../html/
cd ../html
#check for html cleanup tool
which tidy
if [[ 0 = $? ]]; then
  tidy -c -i -wrap 200 cdo.html > index.html
else
  cp cdo.html index.html
fi
cp ../tex/*pdf .
mkdir grids
mv cell.png grids
mv curv.png grids
zip cdo-doc.zip *
