]> granicus.if.org Git - python/commitdiff
build_html(): Simplify, so there's only one version of the latex2html
authorFred Drake <fdrake@acm.org>
Wed, 5 Aug 1998 04:48:18 +0000 (04:48 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 5 Aug 1998 04:48:18 +0000 (04:48 +0000)
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.

Doc/tools/mkhowto.sh

index a30afb2f9f13c54721367d6f85a973e3d3d47818..ec480c517db6ced45eee657aeccc7e8ae7ef7fbf 100755 (executable)
@@ -1,4 +1,4 @@
-#! /depot/gnu/plat/bin/bash
+#! /usr/bin/env bash
 
 MYDIR=`dirname $0`
 WORKDIR=`pwd`
@@ -13,7 +13,10 @@ DEFAULT_FORMAT=PDF
 USE_DEFAULT_FORMAT=true
 DISCARD_TEMPS=true
 
+ICONSERVER=''
+
 L2H_INIT_FILE=$TOPDIR/perl/l2hinit.perl
+L2H_AUX_INIT_FILE=/usr/tmp/mkhowto-$LOGNAME-$$.perl
 
 LOGFILE=/usr/tmp/mkhowto-$LOGNAME-$$.how
 LOGGING=''
@@ -35,6 +38,7 @@ HTML options:
     --address, -a      Specify an address for page footers.
     --link             Specify the number of levels to include on each page.
     --split, -s                Specify a section level for page splitting.
+    --iconserver, -i   Specify location of icons (default: ../).
 
 Other options:
     --a4               Format for A4 paper.
@@ -47,7 +51,7 @@ Other options:
                        (stderr is also lost,  sorry; see *.how for errors)
 
 EOF
-    
+
     exit $1
 }
 
@@ -60,16 +64,10 @@ MAX_SPLIT_DEPTH=8
 
 build_html() {
     TEXFILE=`kpsewhich $1.tex`
-    if [ "$ADDRESS" ] ; then
-       latex2html -init_file $L2H_INIT_FILE \
-        -address "$ADDRESS" \
-        -link $MAX_LINK_DEPTH -split $MAX_SPLIT_DEPTH \
-        -dir $1 $TEXFILE || exit $?
-    else
-       latex2html -init_file $L2H_INIT_FILE \
-        -link $MAX_LINK_DEPTH -split $MAX_SPLIT_DEPTH \
-        -dir $1 $TEXFILE || exit $?
-    fi
+    latex2html \
+     -init_file $L2H_INIT_FILE \
+     -init_file $L2H_AUX_INIT_FILE \
+     -dir $1 $TEXFILE || exit $?
     if [ "$MAX_SPLIT_DEPTH" -ne 1 ] ; then
        (cd $1; $MYDIR/node2label.pl *.html) || exit $?
     fi
@@ -129,6 +127,12 @@ build_ps() {
     dvips -N0 -o $1.ps $1 || exit $?
 }
 
+l2hoption() {
+    if [ "$2" ] ; then
+       echo "\$$1 = \"$2\";" >>$L2H_AUX_INIT_FILE
+    fi
+}
+
 cleanup() {
     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
@@ -164,6 +168,10 @@ while [ "$1" ] ; do
        -H|--help|--hel|--he)
            usage 0
            ;;
+       -i|--iconserver|--iconserve|--iconserv|--iconser|--iconse|--icons|--icon|--ico|--ic|--i)
+           ICONSERVER="$2"
+           shift 2
+           ;;
        -a|--address|--addres|--addre|-addr|--add|--ad)
            ADDRESS="$2"
            shift 2
@@ -227,7 +235,13 @@ if [ "$QUIET" ] ; then
     exec >/dev/null
 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
     FILEDIR=`dirname $FILE`
@@ -236,7 +250,7 @@ for FILE in $@ ; do
     # 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=$FILEDIR:$COMMONTEXINPUTS
+    TEXINPUTS=$FILEDIR:$TOPDIR/texinputs:$TEXINPUTS
     export TEXINPUTS
     #
     if [ "$BUILD_DVI" -o "$BUILD_PS" ] ; then
@@ -264,3 +278,5 @@ for FILE in $@ ; do
     fi
     rm -f $LOGFILE
 done
+
+rm -f $L2H_AUX_INIT_FILE