bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: texi2dvi: better hevea invocation


From: Akim Demaille
Subject: FYI: texi2dvi: better hevea invocation
Date: Tue, 27 Jun 2006 18:23:13 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        Fix the clean invocations to hevea.
        Note that this breaks document using images (to be fixed).
        * util/latex2html.test (run_hevea_check): Extend to support
        various build modes.
        Test them.
        Force the creation of aux files (something the previous test
        failed to do...).
        * util/defs.in (title): New.
        * util/texi2dvi: Fix incorrect "error" invocations.
        (run_hevea): Don't pass -o to hevea.
        Move the result to the expected destination.
        Don't pass -noiso.

Index: util/defs.in
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/defs.in,v
retrieving revision 1.5
diff -u -u -r1.5 defs.in
--- util/defs.in 19 Jun 2006 09:35:01 -0000 1.5
+++ util/defs.in 27 Jun 2006 16:22:38 -0000
@@ -289,6 +289,20 @@
   rm -rf "$@"
 }
 
+
+# title TITLE...
+# --------------
+# Make a huge title to ease the reading of the output.
+title ()
+{
+  (
+    set +x
+    echo "    $@    " | sed -e 's/./=/g'
+    echo "    $@    "
+    echo "    $@    " | sed -e 's/./=/g'
+  )
+}
+
 # Turn on shell traces when VERBOSE is set.
 if test -n "$VERBOSE"; then
   set -x
Index: util/latex2html.test
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/latex2html.test,v
retrieving revision 1.1
diff -u -u -r1.1 latex2html.test
--- util/latex2html.test 30 May 2006 14:44:04 -0000 1.1
+++ util/latex2html.test 27 Jun 2006 16:22:38 -0000
@@ -24,20 +24,41 @@
 
 set -e
 
-create_input_tex </dev/null
+# For the creation of auxiliary files.
+create_input_tex <<EOF
+\tableofcontents
+\section{First}
+\section{Second}
+EOF
 
-# run_hevea_check HTML|INFO|TEXT
+# run_hevea_check FORMAT OPTIONS
+# ------------------------------
 run_hevea_check ()
 {
-  out=$1
+  title "$@"
+
+  format="$1"
+  shift
+
   # Testing the local build mode.
-  TEXI2DVI_pass --$out --batch input.tex
-  # There should only be the DVI and the TEXI file.
-  assert_files input.$out input.tex
-  rm input.$out
+  TEXI2DVI_pass --batch --$format "$@" input.tex
+
+  case $format:$@ in
+    *clean* ) auxfiles='';;
+     *tidy* ) auxfiles='input.t2d';;
+     html:*|text:* ) auxfiles='input.haux input.htoc';;
+      dvi:* ) auxfiles='input.aux input.log input.toc';;
+          * ) auxfiles='';;
+  esac
+  # There should only be the expected output and the source file.
+  assert_files $auxfiles input.$out input.tex
+  rm -fr $auxfiles input.$out
 }
 
-for out in html info text
+for opt in "" "--clean" "--tidy"
 do
-  run_hevea_check $out
+  for out in html info text
+    do
+    run_hevea_check $out $opt
+  done
 done
Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.86
diff -u -u -r1.86 texi2dvi
--- util/texi2dvi 26 Jun 2006 09:29:41 -0000 1.86
+++ util/texi2dvi 27 Jun 2006 16:22:38 -0000
@@ -424,7 +424,7 @@
     dvi | ps | dvipdf ) echo dvi;;
     pdf ) echo $out_lang;;
     html | info | text ) echo $out_lang;;
-    *)    error "$0: invalid out_lang: $1";;
+    *)    error 1 "$0: invalid out_lang: $1";;
   esac
 }
 
@@ -437,7 +437,7 @@
   case $out_lang in
     dvipdf ) echo pdf;;
     dvi | html | info | pdf | ps | text ) echo $out_lang;;
-    *)    error "$0: invalid out_lang: $1";;
+    *)    error 1 "$0: invalid out_lang: $1";;
   esac
 }
 
@@ -1150,7 +1150,11 @@
 
 # run_hevea (MODE)
 # ----------------
-# Convert to HTML.
+# Convert to HTML/INFO/TEXT.
+#
+# Don't pass `-noiso' to hevea: it's useless in HTML since anyway the
+# charset is set to latin1, and troublesome in other modes since
+# accented characters loose their accents.
 run_hevea ()
 {
   local hevea=${HEVEA:-hevea}
@@ -1159,19 +1163,19 @@
   case $1 in
     html) ;;
     text|info) run_hevea="$run_hevea -$1";;
-    *) error "run_hevea: invalid argument: $1";;
+    *) error 1 "run_hevea: invalid argument: $1";;
   esac
 
   # Compiling to the tmp directory enables to preserve a previous
-  # successful compilation.  Unfortunately it makes it hard to move
-  # the image back to the destination directory.  So compile to the
-  # actual destination.
-  run_hevea="$run_hevea -fix -noiso -O -o '$out_name'"
+  # successful compilation.
+  run_hevea="$run_hevea -fix -O -o '$out_base'"
   run_hevea="$run_hevea `list_prefix includes -I` -I '$orig_pwd' "
   run_hevea="$run_hevea '$in_input'"
 
   verbose "running $run_hevea"
-  if eval "$run_hevea" >&5; then :; else
+  if eval "$run_hevea" >&5; then
+    move_to_dest "$out_base"
+  else
     error 1 "$hevea exited with bad status, quitting."
   fi
 }
@@ -1194,7 +1198,7 @@
     latex:html|latex:text|latex:info)
        run_hevea $out_lang;;
     *)
-       error "invalid input/output combination: $in_lang/$out_lang";;
+       error 1 "invalid input/output combination: $in_lang/$out_lang";;
   esac
 
   cd_orig





reply via email to

[Prev in Thread] Current Thread [Next in Thread]