Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12f842e

Browse files
committed
Adjust to allow both general and module indexes.
PDF output properly supports the outline.
1 parent 60961c5 commit 12f842e

1 file changed

Lines changed: 45 additions & 26 deletions

File tree

Doc/tools/mkhowto.sh

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,33 +81,56 @@ build_html() {
8181
fi
8282
}
8383

84-
build_dvi() {
85-
latex $1 || exit $?
86-
latex $1 || exit $?
87-
if [ -f $1.idx ] ; then
88-
`dirname $0`/fix_hack $1.idx || exit $?
89-
makeindex -s $TOPDIR/texinputs/myindex.ist $1.idx || exit $?
84+
use_latex() {
85+
# two args: <file> <latextype>
86+
MYFILE=$1
87+
MYLATEX=$2
88+
#
89+
# We really have to do it three times to get all the page numbers right,
90+
# since the length of the ToC makes a real difference.
91+
#
92+
$MYDIR/newind.py >$MYFILE.ind
93+
$MYDIR/newind.py modindex >mod$MYFILE.ind
94+
$MYLATEX $MYFILE || exit $?
95+
if [ -f mod$MYFILE.idx ] ; then
96+
makeindex mod$MYFILE.idx
97+
fi
98+
if [ -f $MYFILE.idx ] ; then
99+
$MYDIR/fix_hack $MYFILE.idx
100+
makeindex $MYFILE.idx
101+
$MYDIR/indfix.py $MYFILE.ind
102+
fi
103+
$MYLATEX $MYFILE || exit $?
104+
if [ -f mod$MYFILE.idx ] ; then
105+
makeindex mod$MYFILE.idx
90106
fi
91-
latex $1 || exit $?
107+
if [ -f $MYFILE.idx ] ; then
108+
$MYDIR/fix_hack $MYFILE.idx || exit $?
109+
makeindex -s $TOPDIR/texinputs/myindex.ist $MYFILE.idx || exit $?
110+
fi
111+
if [ -f $MYFILE.toc ] ; then
112+
$MYDIR/toc2bkm.py -c section $MYFILE
113+
fi
114+
$MYLATEX $MYFILE || exit $?
92115
}
93116

94-
build_ps() {
95-
# note weird sequence of redirects is used to get stderr to the old stdout
96-
# and the new stdout goes to a file
97-
dvips -N0 -f $1 >$1.ps || exit $?
117+
build_dvi() {
118+
use_latex $1 latex
98119
}
99120

100121
build_pdf() {
101-
# We really have to do it three times to get all the page numbers right,
102-
# since the length of the ToC makes a real difference.
103-
pdflatex $1 || exit $?
104-
pdflatex $1 || exit $?
105-
`dirname $0`/toc2bkm.py -c section $FILE || exit $?
106-
if [ -f $1.idx ] ; then
107-
`dirname $0`/fix_hack $1.idx || exit $?
108-
makeindex -s $TOPDIR/texinputs/myindex.ist $1.idx || exit $?
122+
use_latex $1 pdflatex
123+
}
124+
125+
build_ps() {
126+
dvips -N0 -o $1.ps -f $1 || exit $?
127+
}
128+
129+
cleanup() {
130+
rm -f $1.aux $1.log $1.out $1.toc $1.bkm $1.idx $1.ind
131+
if [ ! "$BUILD_DVI" ] ; then
132+
rm -f $FILE.dvi
109133
fi
110-
pdflatex $1 || exit $?
111134
}
112135

113136
# figure out what our targets are:
@@ -203,13 +226,9 @@ for FILE in $@ ; do
203226
build_html $FILE 2>&1 | tee -a $LOGFILE
204227
fi
205228
if [ "$DISCARD_TEMPS" ] ; then
206-
rm -f $FILE.aux $FILE.log $FILE.out $FILE.toc $FILE.bkm 2>&1 \
207-
| tee -a $LOGFILE
208-
if [ ! "$BUILD_DVI" ] ; then
209-
rm -f $FILE.dvi 2>&1 | tee -a $LOGFILE
210-
fi
229+
cleanup $FILE 2>&1 | tee -a $LOGFILE
211230
fi
212-
# the the logfile around
231+
# keep the logfile around
213232
if [ "$LOGGING" ] ; then
214233
cp $LOGFILE $FILE.how
215234
fi

0 commit comments

Comments
 (0)