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