cgal/Packages/Manual/scripts/to_html_w_parts

135 lines
3.8 KiB
Bash
Executable File

#!/bin/sh
if [ $# -ne 0 ]; then
DOCDIRS="$*"
elif [ -f wrapper.tex ]; then
DOCDIRS="."
elif [ -f docdirs ]; then
DOCDIRS=`cat docdirs`
else
DOCDIRS=""
fi
LATEX_CONV_INPUTS="../../examples:../../demo:$LATEX_CONV_INPUTS"
export LATEX_CONV_INPUTS
for DIR in $DOCDIRS; do
cd $DIR
echo "to_html_w_parts: Now in directory $DIR ..."
CURR_DIR=`pwd`
case "$CURR_DIR" in
*installation) TITLE="CGAL Installation Guide";
INCL="-header ../../include";;
*general) TITLE="CGAL General Introduction";
INCL="-header ../../include";;
*kernel) TITLE="CGAL 2D and 3D Kernel Manuals";
INCL="-header ../../include";;
*kernel_d) TITLE="CGAL dD Kernel Manuals";
INCL="-header ../../include";;
*basic) TITLE="CGAL Basic Library Manuals";
INCL="-header ../../../include";;
*support) TITLE="CGAL Support Library Manuals";
INCL="-header ../../../include";;
*use_of_stl) TITLE="The Use of STL and STL Extensions in CGAL";
INCL="";;
*) echo "UNKNOWN manual part; title will be CGAL Reference Manual";
TITLE="CGAL Reference Manual";
INCL="-header ../../include";;
esac
if [ -d html ]; then
mv html html.bck
fi
mkdir html
HTML_FILES=`ls *.html`
if [ "$HTML_FILES" != "" ]; then
cp *.html html
fi
if [ -f docdirs ]; then
if [ -f docdirs_passed_html ]; then
SUB_DIRS=`cat docdirs_passed_html`
else
SUB_DIRS=`cat docdirs`
fi
DOCMAINS=""
REF_DOCMAINS=""
REF_SUB_DIRS=""
for SUB_DIR in $SUB_DIRS; do
if [ $SUB_DIR != "Title" ]; then
DOCMAINS="$DOCMAINS $SUB_DIR/html_wrapper"
fi
if [ $SUB_DIR != "Title" -a $SUB_DIR != "Preface" ]; then
REF_DOCMAINS="$REF_DOCMAINS ${SUB_DIR}_ref/html_wrapper"
REF_SUB_DIRS="$REF_SUB_DIRS ${SUB_DIR}_ref"
fi
done
EXTENDED="-extended"
else
SUB_DIRS=""
DOCMAINS=wrapper.tex
EXTENDED=""
fi
if [ -f wrapper.bbl -a -s wrapper.bbl ]; then
BBL="-bbl wrapper.bbl"
else
BBL=""
fi
echo "*********************" > html/to_html.log
echo "cc_manual_to_html log" >> html/to_html.log
echo "*********************" >> html/to_html.log
cc_manual_to_html -author "<A HREF=""http://www.cgal.org"" target=""_top"">www.cgal.org</A>" -date "`date +%b` `date +%e`, `date +%Y`" -title "$TITLE" $EXTENDED $INCL $BBL -aux wrapper.aux -o html user_part.tex ${DOCMAINS} -ref_manual ref_part.tex ${REF_DOCMAINS} >> html/to_html.log 2>&1
cd html
echo "*******************************" >> to_html.log
echo "results of grep for references " >> to_html.log
echo "*******************************" >> to_html.log
ref_grep >> to_html.log
echo "********************************" >> to_html.log
echo "results of grep for backslashes " >> to_html.log
echo "********************************" >> to_html.log
backslash_grep >> to_html.log
cd ..
echo >> html/to_html.log
echo "EOF" >> html/to_html.log
if [ -f htmlfiles ]; then
echo "copying html files now..."
cp `cat htmlfiles | dos2unix` html
fi
for SUB_DIR
in $SUB_DIRS $REF_SUB_DIRS
do
if [ -f $SUB_DIR/htmlfiles ]
then
(cd $SUB_DIR;
cp `cat htmlfiles | dos2unix` ../html/$SUB_DIR
cd ..
)
fi
done
if [ -d Title ]; then
cp Title/title.html html
else
cp title.html html
fi
if [ -d html -a -r html/contents.html -a -d html.bck ]
then
rm -rf html.bck
fi
echo "to_html_w_parts: ...leaving directory $DIR"
cd ..
done