#!/bin/sh
set -e
for file in doc/man/*.1;
do filename=`echo $file | sed 's/\.1$//'`
   python twisted/lore/man2lore.py $filename.1 > $filename-man.html
done
baseurl=http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-$1/api/%s.html
templ=doc/howto/template.tpl
for doc in doc/man doc/howto doc/specifications; do
  ./bin/generatelore --docsdir $doc -t $templ --baseurl $baseurl -l ../howto/
done
cp admin/book.tex doc/howto
./bin/html2latex -s doc/howto/*.html doc/man/*.html doc/specifications/*.html
cd doc/howto
for i in 1 2 3;do latex book.tex;done
dvips -o book.ps book.dvi
ps2pdf13 book.ps book.pdf
rm *.eps *.tex *.aux *.log book.dvi book.toc ../man/*.tex \
   ../specifications/*.tex ../man/*-man.html
