Imported Upstream version 0.0.26
[platform/upstream/xmlto.git] / format / fo / dvi
1 case "$1" in
2 stylesheet)
3   ;;
4 post-process)
5   if [ "$VERBOSE" -ge 1 ]
6   then
7     echo >&2 "Post-process XSL-FO to DVI"
8   fi
9   if [ -z "`type -t $XMLTEX_PATH`" ]
10   then
11     echo >&2 "Can't process, xmltex tool not found at $XMLTEX_PATH."
12     exit 3
13   fi
14   # Work around stupid tetex bug with '_' in filenames
15   # Also work around stupid tetex limitation with long lines (rhbz #101055)
16   # and workaround passivetex limitation for chapter titles starting with L
17   # (rhbz #526273)
18   ${SED_PATH} -e "s,/>,/>\n,g" \
19       -e "s,block>,&\n,g" "$XSLT_PROCESSED" >tmp.fo
20   OUT=output
21   TEXINPUTS="$(dirname "$INPUT_FILE")::$SEARCHPATH"
22   export TEXINPUTS
23   "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null || { cat $OUT; exit 1; }
24   [ "$VERBOSE" -ge 2 ] && echo >&2 "First pass complete"
25   # If there were undefined references we need to re-run xmltex.
26   if egrep '^LaTeX Warning: There were undefined references.$' $OUT \
27                                                 >/dev/null 2>&1 \
28   || egrep '^LaTeX Warning: Label.s. may have changed\.' $OUT \
29                                                 >/dev/null 2>&1
30   then
31     "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null
32     [ "$VERBOSE" -ge 2 ] && echo >&2 "Second pass complete"
33     "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null
34     if [ "$VERBOSE" -ge 2 ]
35     then
36       echo >&2 "Third pass complete"
37       [ "$VERBOSE" -ge 3 ] && cat $OUT
38     fi
39   fi
40   ${GCP_PATH:-cp} -R -P -p -- *.dvi "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").dvi"
41   ;;
42 esac