blob: d9527301ae2af039dde2ba0e62dd3f5109573d1a [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
41
42run() {
Fred Drakec4e92631999-01-08 15:32:27 +000043 # show what we're doing, like make does:
44 echo "$*"
Fred Drakebfc18bd2002-05-03 04:50:51 +000045 "$@" || exit $?
Fred Drakec58f3461999-01-08 15:27:17 +000046}
47
48
49# generate the Texinfo file:
50
Fred Drakebfc18bd2002-05-03 04:50:51 +000051run $EMACS -batch -q --no-site-file -l $TOOLSDIR/py2texi.el \
52 --eval "(setq py2texi-dirs '(\"./\" \"../texinputs/\" \"$DOCDIR\"))" \
Fred Drake66abcee2002-11-13 19:31:04 +000053 --eval "(setq py2texi-texi-file-name \"$TEXINAME\")" \
54 --eval "(setq py2texi-info-file-name \"$INFONAME\")" \
Fred Drakebfc18bd2002-05-03 04:50:51 +000055 --eval "(py2texi \"$DOCDIR/$DOCFILE\")" \
56 -f kill-emacs
57echo Done
Fred Drakec58f3461999-01-08 15:27:17 +000058
59
60# generate the .info files:
61
62run $MAKEINFO --footnote-style end --fill-column 72 \
Fred Drake66abcee2002-11-13 19:31:04 +000063 --paragraph-indent 0 --output=$INFONAME $TEXINAME