Fred Drake | c58f346 | 1999-01-08 15:27:17 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # -*- Ksh -*- |
| 3 | |
Fred Drake | c4e9263 | 1999-01-08 15:32:27 +0000 | [diff] [blame] | 4 | # Script to drive the HTML-info conversion process. |
Fred Drake | 66abcee | 2002-11-13 19:31:04 +0000 | [diff] [blame] | 5 | # 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 Drake | c4e9263 | 1999-01-08 15:32:27 +0000 | [diff] [blame] | 9 | # |
| 10 | # Written by Fred L. Drake, Jr. <fdrake@acm.org> |
Fred Drake | c58f346 | 1999-01-08 15:27:17 +0000 | [diff] [blame] | 11 | |
Fred Drake | c58f346 | 1999-01-08 15:27:17 +0000 | [diff] [blame] | 12 | EMACS=${EMACS:-emacs} |
| 13 | MAKEINFO=${MAKEINFO:-makeinfo} |
| 14 | |
| 15 | |
| 16 | # Normalize file name since something called by html2texi.pl seems to |
| 17 | # screw up with relative path names. |
| 18 | FILENAME="$1" |
| 19 | DOCDIR=`dirname "$FILENAME"` |
| 20 | DOCFILE=`basename "$FILENAME"` |
Fred Drake | bfc18bd | 2002-05-03 04:50:51 +0000 | [diff] [blame] | 21 | DOCNAME=`basename "$FILENAME" .tex` |
| 22 | if [ $# -gt 1 ]; then |
Fred Drake | 66abcee | 2002-11-13 19:31:04 +0000 | [diff] [blame] | 23 | TEXINAME="$2" |
| 24 | else |
| 25 | TEXINAME="python-$DOCNAME.texi" |
| 26 | fi |
| 27 | if [ $# -gt 2 ]; then |
| 28 | INFONAME="$3" |
Fred Drake | bfc18bd | 2002-05-03 04:50:51 +0000 | [diff] [blame] | 29 | else |
| 30 | INFONAME="python-$DOCNAME.info" |
| 31 | fi |
Fred Drake | c58f346 | 1999-01-08 15:27:17 +0000 | [diff] [blame] | 32 | |
Fred Drake | c4e9263 | 1999-01-08 15:32:27 +0000 | [diff] [blame] | 33 | # Now build the real directory names, and locate our support stuff: |
Fred Drake | c58f346 | 1999-01-08 15:27:17 +0000 | [diff] [blame] | 34 | WORKDIR=`pwd` |
| 35 | cd `dirname $0` |
| 36 | TOOLSDIR=`pwd` |
| 37 | cd $DOCDIR |
| 38 | DOCDIR=`pwd` |
| 39 | cd $WORKDIR |
| 40 | |
Fred Drake | 1da0bba | 2003-09-29 17:26:08 +0000 | [diff] [blame] | 41 | COMMONDIR="`dirname $DOCDIR`/commontex" |
| 42 | |
Fred Drake | c58f346 | 1999-01-08 15:27:17 +0000 | [diff] [blame] | 43 | |
| 44 | run() { |
Fred Drake | c4e9263 | 1999-01-08 15:32:27 +0000 | [diff] [blame] | 45 | # show what we're doing, like make does: |
| 46 | echo "$*" |
Fred Drake | bfc18bd | 2002-05-03 04:50:51 +0000 | [diff] [blame] | 47 | "$@" || exit $? |
Fred Drake | c58f346 | 1999-01-08 15:27:17 +0000 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | |
| 51 | # generate the Texinfo file: |
| 52 | |
Fred Drake | bfc18bd | 2002-05-03 04:50:51 +0000 | [diff] [blame] | 53 | run $EMACS -batch -q --no-site-file -l $TOOLSDIR/py2texi.el \ |
Fred Drake | 1da0bba | 2003-09-29 17:26:08 +0000 | [diff] [blame] | 54 | --eval "(setq py2texi-dirs '(\"$DOCDIR\" \"$COMMONDIR\" \"../texinputs\"))" \ |
Fred Drake | 66abcee | 2002-11-13 19:31:04 +0000 | [diff] [blame] | 55 | --eval "(setq py2texi-texi-file-name \"$TEXINAME\")" \ |
| 56 | --eval "(setq py2texi-info-file-name \"$INFONAME\")" \ |
Fred Drake | bfc18bd | 2002-05-03 04:50:51 +0000 | [diff] [blame] | 57 | --eval "(py2texi \"$DOCDIR/$DOCFILE\")" \ |
| 58 | -f kill-emacs |
| 59 | echo Done |
Fred Drake | c58f346 | 1999-01-08 15:27:17 +0000 | [diff] [blame] | 60 | |
| 61 | |
| 62 | # generate the .info files: |
| 63 | |
| 64 | run $MAKEINFO --footnote-style end --fill-column 72 \ |
Fred Drake | 66abcee | 2002-11-13 19:31:04 +0000 | [diff] [blame] | 65 | --paragraph-indent 0 --output=$INFONAME $TEXINAME |