libreccm-legacy/ccm-quasi-aplaws/doc/docs-stuff/indexed-html

90 lines
2.4 KiB
Plaintext

# Based on original from Eric Bischoff <eric@caldera.de>
# Create an HTML document with index and figures in place.
# This is done by:
# 1. Converting from SGML to HTML
# 2. Generating an SGML index based on the HTML
# 3. Converting from SGML to HTML (taking into account the index this time)
# 4. Copying figures from original source tree into the output directory
# The end result is a directory tree ready for publishing/packaging/whatever...
# Make sure we have an absolute path to the backend, DSSSL stylesheet, and CSS
STUFFPATH=`dirname $0`
if [ -n "${STUFFPATH##/*}" ]
then
STUFFPATH=$PWD/$STUFFPATH
fi
FINAL_INDEX=generated-index.sgml
INDEXFILE=INDEX$$
CSSFILE=$STUFFPATH/css/rhdocs-man.css
# Convert to HTML, generating the HTML.index file that we'll use to
# create an SGML index...
echo Running $SGML_JADE...
$SGML_JADE -t sgml -V html-index $SGML_ARGUMENTS
# Generate the index, fixing up the problem of bogus empty closing tags (</>)...
echo Indexing...
if [ $LANG = "it_IT" ]; then
SYMBOL="-s Simboli"
elif [ $LANG = "es_ES" ]; then
SYMBOL="-s Símbolos"
else
SYMBOL=""
fi
perl /usr/bin/collateindex.pl -g $SYMBOL -i generated-index -o ../$FINAL_INDEX HTML.index
# Not sure if these are still needed; when we first tried collateindex;
# it threw "</>" in the generated index in certain cases...
cat ../$FINAL_INDEX | sed 's,^[ ]*</>[ ]*$,,' > ../$INDEXFILE
mv -f ../$INDEXFILE ../$FINAL_INDEX
# Nuke the HTML.index file; we don't need it anymore...
rm -f HTML.index
echo Rerunning $SGML_JADE...
$SGML_JADE -t sgml $SGML_ARGUMENTS
echo -n "Copying admon graphics..."
if [ ! -d ./stylesheet-images ]; then
mkdir -p ./stylesheet-images
fi
cp $STUFFPATH/stylesheet-images/*.png ./stylesheet-images/
echo "Done!"
if [ -d ../figs/ ]
then
echo -n "Moving figures..."
(cd ../ ; tar chf - figs/) | (tar xf -)
echo "Done!"
echo -n "Cleaning CVS..."
find ./figs/ -type d -name "CVS"|xargs rm -rf
echo -n "EPS..."
find ./figs/ -type f -name "*eps"|xargs rm -f
echo -n ".xvpics..."
find ./figs/ -type d -name ".xvpics"|xargs rm -rf
echo -n ".dia..."
find ./figs/ -type f -name "*dia"|xargs rm -rf
echo -n "directories..."
find ./figs/ -type d -empty|xargs rm -rf
echo "Done!"
fi
echo -n "Adding css..."
cp $CSSFILE rhdocs-man.css
#addcss.py *.html
echo "Done!"
exit 0