Commit 11300cc7 authored by Fred Drake's avatar Fred Drake

build_html(): Simplify, so there's only one version of the latex2html

	command line.

l2hoption():  Convenience function, to write out an option to the aux. init.
	file only if set.

Added --iconserver option to set the $ICONSERVER variable in latex2html; this
requires the use of an auxillary init. file since this can't be initialized
using a standard latex2html command-line option.  So the aux. init. file is
used for just about all the special options since it has to be written anyway
when $ICONSERVER needs to be set.
parent 1ca8fdc4
#! /depot/gnu/plat/bin/bash #! /usr/bin/env bash
MYDIR=`dirname $0` MYDIR=`dirname $0`
WORKDIR=`pwd` WORKDIR=`pwd`
...@@ -13,7 +13,10 @@ DEFAULT_FORMAT=PDF ...@@ -13,7 +13,10 @@ DEFAULT_FORMAT=PDF
USE_DEFAULT_FORMAT=true USE_DEFAULT_FORMAT=true
DISCARD_TEMPS=true DISCARD_TEMPS=true
ICONSERVER=''
L2H_INIT_FILE=$TOPDIR/perl/l2hinit.perl L2H_INIT_FILE=$TOPDIR/perl/l2hinit.perl
L2H_AUX_INIT_FILE=/usr/tmp/mkhowto-$LOGNAME-$$.perl
LOGFILE=/usr/tmp/mkhowto-$LOGNAME-$$.how LOGFILE=/usr/tmp/mkhowto-$LOGNAME-$$.how
LOGGING='' LOGGING=''
...@@ -35,6 +38,7 @@ HTML options: ...@@ -35,6 +38,7 @@ HTML options:
--address, -a Specify an address for page footers. --address, -a Specify an address for page footers.
--link Specify the number of levels to include on each page. --link Specify the number of levels to include on each page.
--split, -s Specify a section level for page splitting. --split, -s Specify a section level for page splitting.
--iconserver, -i Specify location of icons (default: ../).
Other options: Other options:
--a4 Format for A4 paper. --a4 Format for A4 paper.
...@@ -47,7 +51,7 @@ Other options: ...@@ -47,7 +51,7 @@ Other options:
(stderr is also lost, sorry; see *.how for errors) (stderr is also lost, sorry; see *.how for errors)
EOF EOF
exit $1 exit $1
} }
...@@ -60,16 +64,10 @@ MAX_SPLIT_DEPTH=8 ...@@ -60,16 +64,10 @@ MAX_SPLIT_DEPTH=8
build_html() { build_html() {
TEXFILE=`kpsewhich $1.tex` TEXFILE=`kpsewhich $1.tex`
if [ "$ADDRESS" ] ; then latex2html \
latex2html -init_file $L2H_INIT_FILE \ -init_file $L2H_INIT_FILE \
-address "$ADDRESS" \ -init_file $L2H_AUX_INIT_FILE \
-link $MAX_LINK_DEPTH -split $MAX_SPLIT_DEPTH \ -dir $1 $TEXFILE || exit $?
-dir $1 $TEXFILE || exit $?
else
latex2html -init_file $L2H_INIT_FILE \
-link $MAX_LINK_DEPTH -split $MAX_SPLIT_DEPTH \
-dir $1 $TEXFILE || exit $?
fi
if [ "$MAX_SPLIT_DEPTH" -ne 1 ] ; then if [ "$MAX_SPLIT_DEPTH" -ne 1 ] ; then
(cd $1; $MYDIR/node2label.pl *.html) || exit $? (cd $1; $MYDIR/node2label.pl *.html) || exit $?
fi fi
...@@ -129,6 +127,12 @@ build_ps() { ...@@ -129,6 +127,12 @@ build_ps() {
dvips -N0 -o $1.ps $1 || exit $? dvips -N0 -o $1.ps $1 || exit $?
} }
l2hoption() {
if [ "$2" ] ; then
echo "\$$1 = \"$2\";" >>$L2H_AUX_INIT_FILE
fi
}
cleanup() { cleanup() {
rm -f $1.aux $1.log $1.out $1.toc $1.bkm $1.idx $1.ilg $1.ind $1.syn rm -f $1.aux $1.log $1.out $1.toc $1.bkm $1.idx $1.ilg $1.ind $1.syn
rm -f mod$1.idx mod$1.ilg mod$1.ind rm -f mod$1.idx mod$1.ilg mod$1.ind
...@@ -164,6 +168,10 @@ while [ "$1" ] ; do ...@@ -164,6 +168,10 @@ while [ "$1" ] ; do
-H|--help|--hel|--he) -H|--help|--hel|--he)
usage 0 usage 0
;; ;;
-i|--iconserver|--iconserve|--iconserv|--iconser|--iconse|--icons|--icon|--ico|--ic|--i)
ICONSERVER="$2"
shift 2
;;
-a|--address|--addres|--addre|-addr|--add|--ad) -a|--address|--addres|--addre|-addr|--add|--ad)
ADDRESS="$2" ADDRESS="$2"
shift 2 shift 2
...@@ -227,7 +235,13 @@ if [ "$QUIET" ] ; then ...@@ -227,7 +235,13 @@ if [ "$QUIET" ] ; then
exec >/dev/null exec >/dev/null
fi fi
COMMONTEXINPUTS=$TOPDIR/texinputs:$TEXINPUTS echo '# auxillary init file for latex2html' >$L2H_AUX_INIT_FILE
echo '# generated by mkhowto.sh -- do no edit' >>$L2H_AUX_INIT_FILE
l2hoption ICONSERVER "$ICONSERVER"
l2hoption ADDRESS "$ADDRESS"
l2hoption MAX_LINK_DEPTH "$MAX_LINK_DEPTH"
l2hoption MAX_SPLIT_DEPTH "$MAX_SPLIT_DEPTH"
echo '1;' >>$L2H_AUX_INIT_FILE
for FILE in $@ ; do for FILE in $@ ; do
FILEDIR=`dirname $FILE` FILEDIR=`dirname $FILE`
...@@ -236,7 +250,7 @@ for FILE in $@ ; do ...@@ -236,7 +250,7 @@ for FILE in $@ ; do
# Put the directory the .tex file is in is also the first directory in # Put the directory the .tex file is in is also the first directory in
# TEXINPUTS, to allow files there to override files in the common area. # TEXINPUTS, to allow files there to override files in the common area.
# #
TEXINPUTS=$FILEDIR:$COMMONTEXINPUTS TEXINPUTS=$FILEDIR:$TOPDIR/texinputs:$TEXINPUTS
export TEXINPUTS export TEXINPUTS
# #
if [ "$BUILD_DVI" -o "$BUILD_PS" ] ; then if [ "$BUILD_DVI" -o "$BUILD_PS" ] ; then
...@@ -264,3 +278,5 @@ for FILE in $@ ; do ...@@ -264,3 +278,5 @@ for FILE in $@ ; do
fi fi
rm -f $LOGFILE rm -f $LOGFILE
done done
rm -f $L2H_AUX_INIT_FILE
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment