tex_l2h.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #! /bin/sh
  2. LC_ALL=C; export LC_ALL
  3. basename=tex_l2h
  4. diffs_dir=diffs
  5. logfile=$basename.log
  6. stdout_file=$basename.out
  7. [ "z$srcdir" = 'z' ] && srcdir=.
  8. if which latex2html > /dev/null 2>&1; then
  9. :
  10. else
  11. exit 77
  12. fi
  13. [ -d $diffs_dir ] || mkdir $diffs_dir
  14. echo "$basename" > $logfile
  15. : > $stdout_file
  16. if tmp_dir=`mktemp -p /tmp -d l2h_t2h_XXXXXXXX`; then
  17. :
  18. else
  19. exit 1
  20. fi
  21. [ -d $basename ] && rm -rf $basename
  22. mkdir $basename
  23. echo "perl -w -x $srcdir/../../texi2html.pl --set-init-var 'TEST 1' --set-init-var 'L2H_CLEAN 0' --set-init-var 'L2H_TMP $tmp_dir' --conf-dir $srcdir/../../examples --l2h --l2h-file $srcdir/../../examples/l2h.init --expand tex --out $basename/ $srcdir/../manuals/mini_ker.texi $srcdir/../formatting/tex.texi >> $stdout_file 2>$basename/${basename}.2" >> $logfile
  24. perl -w -x $srcdir/../../texi2html.pl --set-init-var 'TEST 1' --set-init-var 'L2H_CLEAN 0' --set-init-var "L2H_TMP $tmp_dir" --conf-dir $srcdir/../../examples --l2h --l2h-file $srcdir/../../examples/l2h.init --expand tex --out $basename/ $srcdir/../manuals/mini_ker.texi $srcdir/../formatting/tex.texi >> $stdout_file 2>$basename/${basename}.2
  25. return_code=0
  26. ret=$?
  27. if [ $ret != 0 ]; then
  28. echo "F: $basename/$basename.2"
  29. return_code=1
  30. else
  31. rm -f $basename/*_l2h_images.log $basename/*.aux $basename/*_l2h.css $basename/*.png
  32. sed -i -e 's/^texexpand.*/texexpand /' "$basename/$basename.2"
  33. sed -i '/is no longer supported at.*line/d' "$basename/$basename.2"
  34. sed -i -e 's/CONTENT="LaTeX2HTML.*/CONTENT="LaTeX2HTML">/' -e \
  35. 's/with LaTeX2HTML.*/with LaTeX2HTML/' "$basename/"*"_l2h.html"
  36. sed -i -e 's/^# LaTeX2HTML.*/# LaTeX2HTML/' "$basename/"*"_l2h_images.pl" "$basename/"*"_l2h_labels.pl"
  37. sed -i -e 's/WIDTH="\([0-9]*\)\([0-9]\)"/WIDTH="100"/' -e 's/HEIGHT="\([0-9]*\)\([0-9]\)"/HEIGHT="12"/' "$basename/"*"_l2h_images.pl" "$basename/"*.html "$basename/"*-l2h_cache.pm
  38. # order of entries in *_l2h_images is not reproducible
  39. rm -f "$basename/"*".aux" "$basename/"*"_l2h_images.out" "$basename/"*"_l2h_images.pl"
  40. for dir in ${basename}; do
  41. if [ -d $srcdir/${dir}_res ]; then
  42. diff -u --exclude=CVS --exclude=.svn --exclude='*.png' -r "$srcdir/${dir}_res" "${dir}" 2>>$logfile > "$diffs_dir/$dir.diff"
  43. dif_ret=$?
  44. if [ $dif_ret != 0 ]; then
  45. echo "D: $diffs_dir/$dir.diff"
  46. return_code=1
  47. else
  48. rm "$diffs_dir/$dir.diff"
  49. fi
  50. else
  51. echo "no res: ${dir}_res"
  52. fi
  53. done
  54. fi
  55. rm -rf $tmp_dir
  56. exit $return_code