115 } |
115 } |
116 |
116 |
117 |
117 |
118 # prepare document |
118 # prepare document |
119 |
119 |
120 function pre_latex () |
|
121 { |
|
122 local FMT="$1" |
|
123 [ -n "$CLEAN" ] && rm -f *.aux *.out *.ind *.idx *.ilg *.bbl *.blg *.log |
|
124 "$ISABELLE_TOOL" latex -o sty "$ROOT_NAME.tex" && \ |
|
125 "$ISABELLE_TOOL" latex -o "$FMT" "$ROOT_NAME.tex" && \ |
|
126 { [ ! -f "$ROOT_NAME.bib" ] || "$ISABELLE_TOOL" latex -o bbl "$ROOT_NAME.tex"; } && \ |
|
127 { [ ! -f "$ROOT_NAME.idx" ] || "$ISABELLE_TOOL" latex -o idx "$ROOT_NAME.tex"; } && \ |
|
128 "$ISABELLE_TOOL" latex -o "$FMT" "$ROOT_NAME.tex" |
|
129 } |
|
130 |
|
131 ( |
120 ( |
132 cd "$DIR" || fail "Bad directory '$DIR'" |
121 cd "$DIR" || fail "Bad directory '$DIR'" |
133 |
122 |
134 [ -n "$CLEAN" ] && rm -f "../$NAME.$OUTFORMAT" |
123 [ -n "$CLEAN" ] && rm -f "../$NAME.$OUTFORMAT" |
135 |
124 |
136 prep_tags |
125 prep_tags |
137 |
126 |
138 if [ -f build ]; then |
127 if [ -f build ]; then |
139 ./build "$OUTFORMAT" "$NAME" |
128 ./build "$OUTFORMAT" "$NAME" |
140 RC="$?" |
129 RC="$?" |
141 elif [ "$OUTFORMAT" = pdf ]; then |
|
142 pre_latex pdf && \ |
|
143 "$ISABELLE_TOOL" latex -o pdf "$ROOT_NAME.tex" |
|
144 RC="$?" |
|
145 else |
130 else |
146 pre_latex dvi && \ |
131 [ -n "$CLEAN" ] && rm -f *.aux *.out *.ind *.idx *.ilg *.bbl *.blg *.log |
|
132 "$ISABELLE_TOOL" latex -o sty "$ROOT_NAME.tex" && \ |
|
133 "$ISABELLE_TOOL" latex -o "$OUTFORMAT" "$ROOT_NAME.tex" && \ |
|
134 { [ ! -f "$ROOT_NAME.bib" ] || "$ISABELLE_TOOL" latex -o bbl "$ROOT_NAME.tex"; } && \ |
|
135 { [ ! -f "$ROOT_NAME.idx" ] || "$ISABELLE_TOOL" latex -o idx "$ROOT_NAME.tex"; } && \ |
|
136 "$ISABELLE_TOOL" latex -o "$OUTFORMAT" "$ROOT_NAME.tex" && \ |
147 "$ISABELLE_TOOL" latex -o "$OUTFORMAT" "$ROOT_NAME.tex" |
137 "$ISABELLE_TOOL" latex -o "$OUTFORMAT" "$ROOT_NAME.tex" |
148 RC="$?" |
138 RC="$?" |
149 fi |
139 fi |
150 |
140 |
151 if [ "$RC" -eq 0 -a -f "$ROOT_NAME.$OUTFORMAT" ]; then |
141 if [ "$RC" -eq 0 -a -f "$ROOT_NAME.$OUTFORMAT" ]; then |