blob: be75168fd2499ea8c949c330e3849cc56e4b825d [file] [log] [blame]
Fred Drakec58f3461999-01-08 15:27:17 +00001#! /bin/sh
2# -*- Ksh -*-
3
Fred Drakec4e92631999-01-08 15:32:27 +00004# Script to drive the HTML-info conversion process.
Fred Drake66abcee2002-11-13 19:31:04 +00005# Pass in upto three parameters:
6# - the name of the main tex file
7# - the name of the output file in texi format (optional)
8# - the name of the output file in info format (optional)
Fred Drakec4e92631999-01-08 15:32:27 +00009#
10# Written by Fred L. Drake, Jr. <fdrake@acm.org>
Fred Drakec58f3461999-01-08 15:27:17 +000011
Fred Drakec58f3461999-01-08 15:27:17 +000012EMACS=${EMACS:-emacs}
13MAKEINFO=${MAKEINFO:-makeinfo}
14
15
16# Normalize file name since something called by html2texi.pl seems to
17# screw up with relative path names.
18FILENAME="$1"
19DOCDIR=`dirname "$FILENAME"`
20DOCFILE=`basename "$FILENAME"`
Fred Drakebfc18bd2002-05-03 04:50:51 +000021DOCNAME=`basename "$FILENAME" .tex`
22if [ $# -gt 1 ]; then
Fred Drake66abcee2002-11-13 19:31:04 +000023 TEXINAME="$2"
24else
25 TEXINAME="python-$DOCNAME.texi"
26fi
27if [ $# -gt 2 ]; then
28 INFONAME="$3"
Fred Drakebfc18bd2002-05-03 04:50:51 +000029else
30 INFONAME="python-$DOCNAME.info"
31fi
Fred Drakec58f3461999-01-08 15:27:17 +000032
Fred Drakec4e92631999-01-08 15:32:27 +000033# Now build the real directory names, and locate our support stuff:
Fred Drakec58f3461999-01-08 15:27:17 +000034WORKDIR=`pwd`
35cd `dirname $0`
36TOOLSDIR=`pwd`
37cd $DOCDIR
38DOCDIR=`pwd`
39cd $WORKDIR
40
Fred Drake1da0bba2003-09-29 17:26:08 +000041COMMONDIR="`dirname $DOCDIR`/commontex"
42
Fred Drakec58f3461999-01-08 15:27:17 +000043
44run() {
Fred Drakec4e92631999-01-08 15:32:27 +000045 # show what we're doing, like make does:
46 echo "$*"
Fred Drakebfc18bd2002-05-03 04:50:51 +000047 "$@" || exit $?
Fred Drakec58f3461999-01-08 15:27:17 +000048}
49
50
51# generate the Texinfo file:
52
Fred Drakebfc18bd2002-05-03 04:50:51 +000053run $EMACS -batch -q --no-site-file -l $TOOLSDIR/py2texi.el \
Fred Drake1da0bba2003-09-29 17:26:08 +000054 --eval "(setq py2texi-dirs '(\"$DOCDIR\" \"$COMMONDIR\" \"../texinputs\"))" \
Fred Drake66abcee2002-11-13 19:31:04 +000055 --eval "(setq py2texi-texi-file-name \"$TEXINAME\")" \
56 --eval "(setq py2texi-info-file-name \"$INFONAME\")" \
Fred Drakebfc18bd2002-05-03 04:50:51 +000057 --eval "(py2texi \"$DOCDIR/$DOCFILE\")" \
58 -f kill-emacs
59echo Done
Fred Drakec58f3461999-01-08 15:27:17 +000060
61
62# generate the .info files:
63
64run $MAKEINFO --footnote-style end --fill-column 72 \
Fred Drake66abcee2002-11-13 19:31:04 +000065 --paragraph-indent 0 --output=$INFONAME $TEXINAME