1#!/bin/bash
2#
3if [ $# -gt 0 ]; then
4   echo "--> Using user specified html directory: $1"
5   HTMLDIR="$1"
6else
7   HTMLDIR="${DOC_DIRECTORY}/Dalton_HTMLmanual"
8if [ -d "$HTMLDIR" ]; then
9   echo "--> html output directory $HTMLDIR exists"
10else
11   echo "--> html directory $HTMLDIR does not exist - creating it ..."
12   mkdir $HTMLDIR
13fi
14
15fi
16if [ -d "$HTMLDIR" ]; then
17   echo "--> html output directory $HTMLDIR exists"
18else
19   echo "--> html directory $HTMLDIR does not exist - creating it ..."
20   mkdir $HTMLDIR
21fi
22
23DOC_DIRECTORY=${DOC_DIRECTORY:-.}
24# Declare variables
25#
26if [ -n "$DALTON_VERSION" ]; then
27   RELEASE_VERSION=$DALTON_VERSION
28   echo "--> User specified release version: $RELEASE_VERSION"
29elif [ -n "$RELEASE_VERSION" ]; then
30   echo "--> User specified release version: $RELEASE_VERSION"
31else
32   DALTON_VERSION=${DALTON_VERSION:-../../VERSION}
33   RELEASE_VERSION=`cut -d ' ' -f 1 ${DALTON_VERSION}`
34fi
35
36if [ ! -d $DOC_DIRECTORY ]; then
37   echo '--> ERROR, Dalton document directory "' $DOC_DIRECTORY '" does not exist!'
38   exit 1
39fi
40
41cp -t $HTMLDIR $DOC_DIRECTORY/*.tex
42cp -t $HTMLDIR $DOC_DIRECTORY/*.bib
43
44cd $HTMLDIR
45HTMLDIR=`pwd`
46
47if [ -z Master.tex ]; then
48   echo 'ERROR, Dalton Master.tex does not exist in "' $HTMLDIR '".'
49   exit 2
50fi
51
52# debug print:
53#echo "current directory is `pwd` =? " $DOC_DIRECTORY
54#echo "DALTON_VERSION is " $DALTON_VERSION
55#echo "RELEASE_VERSION is " $RELEASE_VERSION
56#echo "HTMLDIR is " $HTMLDIR
57
58echo "--> Generation of .aux files with latex is needed for latex2html"
59
60#
61# Run latex2html
62#
63(latex Master; bibtex Master; latex Master; latex Master; makeindex Master; latex Master) \
64>& dalton_latex.log
65
66echo "--> Output from latex2html will be in dalton_latex2html.log"
67
68latex2html -transparent -font_size 11pt -no_antialias -local_icons \
69    -address "Dalton Manual - Release ${RELEASE_VERSION}" -dir $HTMLDIR Master.tex >& dalton_latex2html.log
70mv Master.html Dalton_Master.html
71
72# clean-up
73rm *.aux *.ind *.blg *.bbl *.toc *.tex *.bib
74
75echo "--> Dalton html manual is now created in $HTMLDIR; html root file is Dalton_Master.html"
76#
77# Post-processing from release 1.2.1
78#
79# sed 's/<PRE>/<\!--/' $HTMLDIR/footnode.html > $HTMLDIR/footnode.tmp
80# sed 's/<\/PRE>/-->/' $HTMLDIR/footnode.tmp > $HTMLDIR/footnode.tmp2
81# mv -f $HTMLDIR/footnode.tmp2 $HTMLDIR/footnode.html
82# rm -f $HTMLDIR/footnode.tm*
83# sed 's/http\:\/\/www.emsl.pnl.gov:2080\/forms\/basisform.html/<a target\=\"ext\" href=\"http\:\/\/www.emsl.pnl.gov:2080\/forms\/basisform.html\">http\:\/\/www.emsl.pnl.gov:2080\/forms\/basisform.html<\/a>/' $HTMLDIR/node118.html > $HTMLDIR/node118.tmp
84# mv -f $HTMLDIR/node118.tmp $HTMLDIR/node118.html
85# sed 's/http\:\/\/garm.teokem.lu.se\/MOLCAS\//<a target\=\"ext\" href=\"http\:\/\/garm.teokem.lu.se\/MOLCAS\/\">http\:\/\/garm.teokem.lu.se\/MOLCAS\/<\/a>/' $HTMLDIR/node118.html > $HTMLDIR/node118.tmp
86# mv -f $HTMLDIR/node118.tmp $HTMLDIR/node118.html
87# echo "BODY {background-color: #ffffff; color: #000000}" >> $HTMLDIR/Master.css
88# echo "A:link {color: #6060bb}" >> $HTMLDIR/Master.css
89# echo "A:visited {color: #999999}" >> $HTMLDIR/Master.css
90