[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: texi2dvi --info/--text for LaTeX
From: |
Akim Demaille |
Subject: |
FYI: texi2dvi --info/--text for LaTeX |
Date: |
Tue, 30 May 2006 16:46:30 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
Index: ChangeLog
from Akim Demaille <address@hidden>
* util/texi2dvi: Add support for latex to text and info using
hevea.
Don't document it yet, as it's preliminary and on some regards
incomplete. It is usable though.
(IFS): Use a more robust definition, taken from Autoconf.
(bibaux_file_p): New, extracted from...
(run_html): Generalize and rename as...
(run_hevea): this.
(run_core_conversion): Adjust.
(option processing): Accept --text and --info.
* configure.ac: Check for TEX and HEVEA.
* util/defs.in: No longer create a texi file by default.
Handle hevea requests.
(create_input_tex, create_input_texi): New.
(assert_files, list_files): Rework to use diff instead of test.
And sort both lists of files before comparing them.
* util/latex2html.test: New.
* util/Makefile.am (TESTS): Update.
Index: configure.ac
===================================================================
RCS file: /cvsroot/texinfo/texinfo/configure.ac,v
retrieving revision 1.61
diff -u -u -w -r1.61 configure.ac
--- configure.ac 30 Sep 2005 17:21:49 -0000 1.61
+++ configure.ac 30 May 2006 14:43:17 -0000
@@ -209,6 +209,11 @@
AM_GNU_GETTEXT_VERSION([0.14.5])
AM_GNU_GETTEXT([external])
+# The test suite.
+AC_CONFIG_FILES([util/defs])
+AC_CHECK_PROGS([HEVEA], [hevea], [])
+AC_CHECK_PROGS([TEX], [tex], [])
+
AC_CONFIG_FILES([
Makefile
doc/Makefile
@@ -217,6 +222,6 @@
makeinfo/Makefile
makeinfo/tests/Makefile
po/Makefile.in
- util/Makefile util/defs
+ util/Makefile
])
AC_OUTPUT
Index: util/Makefile.am
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/Makefile.am,v
retrieving revision 1.19
diff -u -u -w -r1.19 Makefile.am
--- util/Makefile.am 29 Sep 2005 21:06:23 -0000 1.19
+++ util/Makefile.am 30 May 2006 14:43:17 -0000
@@ -56,7 +56,7 @@
XFAIL_TESTS =
TESTS = \
-local.test texi2dvi.test
+latex2html.test local.test texi2dvi.test
EXTRA_DIST += $(TESTS)
Index: util/defs.in
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/defs.in,v
retrieving revision 1.2
diff -u -u -w -r1.2 defs.in
--- util/defs.in 18 Jan 2006 11:56:04 -0000 1.2
+++ util/defs.in 30 May 2006 14:43:17 -0000
@@ -82,6 +82,10 @@
do
# Check that each required tool is present.
case $tool in
+ hevea)
+ # HeVeA supports -version only. Use configure to find it.
+ test -n "@HEVEA@" || exit 77
+ ;;
tex)
# No all versions of Tex support `--version', so we use
# a configure check.
@@ -117,18 +121,7 @@
cd ./testSubDir
-# Build appropriate environment in test directory.
-cat > input.texi << END
-\input texinfo @c -*-texinfo-*-
address@hidden input
address@hidden input
-
address@hidden
address@hidden Top
address@hidden input
address@hidden ifnottex
-END
unset TEXI2DVI_BUILD_MODE
unset TEXI2DVI_BUILD_DIRECTORY
@@ -150,6 +143,51 @@
testsrcdir=$srcdir
unset srcdir
+
+# create_input_texi < INPUT
+# -------------------------
+# Create input.texi adding stdin inside a default prologue/epilogue
+create_input_texi ()
+{
+ {
+ cat << END
+\input texinfo @c -*-texinfo-*-
address@hidden input
address@hidden input
+
address@hidden
address@hidden Top
address@hidden input
address@hidden ifnottex
+
+END
+ cat
+ cat << END
address@hidden
+END
+ } >input.texi
+}
+
+
+# create_input_tex < INPUT
+# ------------------------
+# Create input.tex adding stdin inside a default prologue/epilogue
+create_input_tex ()
+{
+ {
+ cat << END
+\documentclass{article}
+
+\begin{document}
+END
+ cat
+ cat << END
+\end{document}
+END
+ } >input.tex
+}
+
+
# TEXI2DVI_run status [options...]
# --------------------------------
# Run texi2dvi with OPTIONS, and fail if does not exit with STATUS.
@@ -169,6 +207,7 @@
test $exitcode = $expected_exitcode || exit 1
}
+
# TEXI2DVI_fail [options...]
# ---------------------------
# Run texi2dvi with OPTIONS, and fail if does not exit with failure.
@@ -177,6 +216,7 @@
TEXI2DVI_run 1 ${1+"$@"}
}
+
# TEXI2DVI_pass [options...]
# ---------------------------
# Run texi2dvi with OPTIONS, and fail if does not exit with failure.
@@ -185,21 +225,22 @@
TEXI2DVI_run 0 ${1+"$@"}
}
+
# list_files ()
# -------------
-# Return the space separated sorted list of files in this directory,
-# except the "invisible" ones.
+# Return the sorted list of files in this directory, except the "invisible"
ones.
list_files ()
{
- echo `for f in *
+ for f in *
do
case $f in
- texinfo.tex | stdout | stderr);;
+ texinfo.tex | stdout | stderr | ls.expected | ls.value );;
*) echo $f;;
esac
- done | sort`
+ done | sort
}
+
# assert_files (EXPECTED-FILES)
# -----------------------------
# Only those files are valid in the current directory.
@@ -208,7 +249,9 @@
if test -n "$VERBOSE"; then
ls
fi
- test "`list_files`" = "$*" || exit 1
+ list_files > ls.value
+ echo "$*" | tr ' ' '\n' | sort > ls.expected
+ diff -u ls.expected ls.value
}
# Turn on shell traces when VERBOSE is set.
Index: util/latex2html.test
===================================================================
RCS file: util/latex2html.test
diff -N util/latex2html.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ util/latex2html.test 30 May 2006 14:43:17 -0000
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Texinfo.
+#
+# GNU Texinfo is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Texinfo is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Texinfo; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+required='hevea'
+
+. ./defs || exit 1
+
+set -e
+
+create_input_tex </dev/null
+
+# run_hevea_check HTML|INFO|TEXT
+run_hevea_check ()
+{
+ out=$1
+ # 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
+}
+
+for out in html info text
+do
+ run_hevea_check $out
+done
Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.79
diff -u -u -w -r1.79 texi2dvi
--- util/texi2dvi 27 May 2006 19:08:14 -0000 1.79
+++ util/texi2dvi 30 May 2006 14:43:18 -0000
@@ -168,8 +168,11 @@
# restore IFS and apparently POSIX allows stupid/broken behavior with
# empty-but-set IFS.
# http://lists.gnu.org/archive/html/automake-patches/2006-05/msg00008.html
-IFS="
-"
+# We need space, tab and new line, in precisely that order. And don't leave
+# trailing blanks.
+newline='
+'
+IFS=" $newline"
# Systems which define $COMSPEC or $ComSpec use semicolons to separate
# directories in TEXINPUTS -- except for Cygwin, where COMSPEC might be
@@ -186,6 +189,7 @@
# In case someone crazy insists on using grep -E.
: ${EGREP=egrep}
+
## --------------------- ##
## Auxiliary functions. ##
## --------------------- ##
@@ -491,6 +495,26 @@
esac
}
+# bibaux_file_p FILE
+# ------------------
+# Return with success with FILE is an aux file containing citation
+# requests.
+aux_file_p ()
+{
+ test -s "$1" || return 1
+ if (grep '^\\bibstyle[{]' "$1" \
+ && grep '^\\bibdata[{]' "$1" \
+ ## The following line is suspicious: fails when there
+ ## are citations in sub aux files. We need to be
+ ## smarter in this case.
+ ## && grep '^\\citation[{]' "$f"
+ ) >&6 2>&1;
+ then
+ return 0
+ fi
+ return 1
+}
+
# index_file_p FILE
# -----------------
# Return with success with FILE is an index file.
@@ -727,10 +751,6 @@
# - If some citations are missing (LOG contains `Citation').
# or the LOG complains of a missing .bbl
#
-# We run bibtex first, because I can see reasons for the indexes
-# to change after bibtex is run, but I see no reason for the
-# converse.
-#
# Don't try to be too smart:
#
# 1. Running bibtex only if the bbl file exists and is older than
@@ -829,6 +849,9 @@
xref_files_save
+ # We run bibtex first, because I can see reasons for the indexes
+ # to change after bibtex is run, but I see no reason for the
+ # converse.
run_bibtex
run_index
run_tex
@@ -1043,23 +1066,30 @@
}
-# run_to_html ()
-# --------------
+# run_hevea (MODE)
+# ----------------
# Convert to HTML.
-run_to_html ()
+run_hevea ()
{
- hevea=${HEVEA:-hevea}
+ local hevea=${HEVEA:-hevea}
+ local run_hevea="$hevea"
+
+ case $1 in
+ html) ;;
+ text|info) run_hevea="$run_hevea -$1";;
+ *) fatal "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.
- local to_html="$hevea -fix -noiso -O -o '$out_name'"
- to_html="$to_html `list_prefix includes -I`"
- to_html="$to_html '$in_input'"
+ run_hevea="$run_hevea -fix -noiso -O -o '$out_name'"
+ run_hevea="$run_hevea `list_prefix includes -I` -I '$orig_pwd' "
+ run_hevea="$run_hevea '$in_input'"
- verbose "running $to_html"
- if eval "$to_html" >&5; then :; else
+ verbose "running $run_hevea"
+ if eval "$run_hevea" >&5; then :; else
fatal 1 "$hevea exited with bad status, quitting."
fi
}
@@ -1076,9 +1106,13 @@
cd "$work_build" || exit 1
fi
- case $out_lang in
- dvi|pdf) run_tex_suite;;
- html ) run_to_html;;
+ case $language:$out_lang in
+ *:dvi|*:pdf)
+ run_tex_suite;;
+ latex:html|latex:text|latex:info)
+ run_hevea $out_lang;;
+ *)
+ fatal "invalid input/output combination: $language/$out_lang";;
esac
cd_orig
@@ -1210,6 +1244,7 @@
val=`absolute "$1"`
list_append includes "$val"
;;
+ --info) out_lang=info;;
-l | --lang | --language) shift; set_language=$1;;
--mostly-clean) action=mostly-clean;;
--no-line-error) no_line_error=true;;
@@ -1223,6 +1258,7 @@
--recode-from) shift; recode=true; recode_from="$1";;
-t | --texinfo | --command ) shift; textra="$textra\\
"`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;;
+ --text) out_lang=text;;
--translate-file ) shift; translate_file="$1";;
--tidy) build_mode=tidy;;
-v | --vers*) echo "$version"; exit 0;;
Index: util/texi2dvi.test
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi.test,v
retrieving revision 1.9
diff -u -u -w -r1.9 texi2dvi.test
--- util/texi2dvi.test 18 Jan 2006 11:56:04 -0000 1.9
+++ util/texi2dvi.test 30 May 2006 14:43:18 -0000
@@ -22,9 +22,7 @@
set -e
-cat >>input.texi <<EOF
address@hidden
-EOF
+create_input_texi </dev/null
# Testing the local build mode.
TEXI2DVI_pass --batch input.texi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: texi2dvi --info/--text for LaTeX,
Akim Demaille <=