bug-texinfo
[Top][All Lists]
Advanced

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

Re: another serious `texi2dvi -E' bug


From: Werner LEMBERG
Subject: Re: another serious `texi2dvi -E' bug
Date: Sun, 23 Nov 2008 15:20:45 +0100 (CET)

> The ideal fix of course is to get rid of the `sed' kludge in
> texi2dvi, perhaps by adding an option `--only-ifformat' to makeinfo,
> limiting the effect of any `--ifFORMAT' command line option so that
> only @ifFORMAT is handled and @FORMAT is ignored.

Attached is a trivial patch which implements this.  Here an example
how to use it.

  > cat test

  @alias bar = emph
  @tex
  \gdef\bar#1{start #1 end}
  @end tex

  @macro foo{TEXT}
  @bar{\TEXT\}
  @end macro

Process this with

  makeinfo -E test.expanded --iftex --no-ifinfo --only-ifformat test

[Note the use of @alias which provides a dummy definition for @bar
 (which makeinfo doesn't expand).  Without that, `makeinfo -E' aborts.
 During a TeX run, the code in the @tex block immediately overwrites
 the @alias.

 As usual, the second argument to @alias should be a texinfo macro
 which is `similar' to the one which gets defined in the @tex block:
 It should have the same number of arguments and the same calling
 syntax.  For example, you can't say address@hidden bar = findex' since the
 latter doesn't use braces and must be on its own line.]

For the really complicated lilypond.texinfo stuff, it works just fine.
If you like my change, I can modify texi2dvi accordingly to check
whether makeinfo understands --only-ifformat, then omitting the the
$comment_iftex stuff.


    Werner


======================================================================


2008-11-23  Werner Lemberg  <address@hidden>

        Implement option --only-ifformat to process @ifFORMAT but not
        @FORMAT.

        * makeinfo/makeinfo.h (only_ifformat): New global variable.

        * makeinfo/makeinfo.c (long_options): Add `--only-ifformat'.
        (usage): Document it.

        * makeinfo/insertion.c (cm_html, cm_xml, cm_docbook, cm_tex):
        Use `only_ifformat).


--- ./makeinfo/makeinfo.h.old   2008-03-27 09:08:54.000000000 +0100
+++ ./makeinfo/makeinfo.h       2008-11-23 13:39:36.000000000 +0100
@@ -223,6 +223,10 @@
 /* Nonzero means that we process @xml and @ifxml.  (--ifxml) */
 DECLARE (int, process_xml, 0);
 
+/* Nonzero means that we only process @ifFORMAT but not @FORMAT.  To be
+   used in conjunction with --iftex and siblings.  (--only-ifformat) */
+DECLARE (int, only_ifformat, 0);
+
 /* Default is to check node references.  (--no-validate) */
 DECLARE (int, validating, 1);
 
--- ./makeinfo/insertion.c.old  2008-04-24 07:01:44.000000000 +0200
+++ ./makeinfo/insertion.c      2008-11-23 13:39:05.000000000 +0100
@@ -1772,7 +1772,7 @@
 void
 cm_html (int arg)
 {
-  if (process_html)
+  if (process_html && !only_ifformat)
     begin_insertion (rawhtml);
   else
     command_name_condition ();
@@ -1781,7 +1781,7 @@
 void
 cm_xml (int arg)
 {
-  if (process_xml)
+  if (process_xml && !only_ifformat)
     begin_insertion (rawxml);
   else
     command_name_condition ();
@@ -1790,7 +1790,7 @@
 void
 cm_docbook (int arg)
 {
-  if (process_docbook)
+  if (process_docbook && !only_ifformat)
     begin_insertion (rawdocbook);
   else
     command_name_condition ();
@@ -1874,7 +1874,7 @@
 void
 cm_tex (void)
 {
-  if (process_tex)
+  if (process_tex && !only_ifformat)
     begin_insertion (rawtex);
   else
     command_name_condition ();
--- ./makeinfo/makeinfo.c.old   2008-08-29 12:27:29.000000000 +0200
+++ ./makeinfo/makeinfo.c       2008-11-23 14:23:09.000000000 +0100
@@ -447,6 +447,7 @@
   --no-ifplaintext  do not process @ifplaintext text.\n\
   --no-iftex        do not process @iftex and @tex text.\n\
   --no-ifxml        do not process @ifxml and @xml text.\n\
+  --only-ifformat   process @ifFORMAT but not @FORMAT.\n\
 \n\
   Also, for the --no-ifFORMAT options, do process @ifnotFORMAT text.\n\
 "));
@@ -470,6 +471,7 @@
   makeinfo --html --no-headers foo.texi  write html without node lines, 
menus\n\
   makeinfo --number-sections foo.texi    write Info with numbered sections\n\
   makeinfo --no-split foo.texi           write one Info file however big\n\
+  makeinfo --iftex --only-ifformat       process @iftex but not @tex\n\
 "), stdout);
 
     puts (_("\n\
@@ -524,6 +526,7 @@
   { "no-warn", 0, &print_warnings, 0 },
   { "number-footnotes", 0, &number_footnotes, 1 },
   { "number-sections", 0, &number_sections, 1 },
+  { "only-ifformat", 0, &only_ifformat, 1 },
   { "output", 1, 0, 'o' },
   { "output-indent", 1, 0, 'i' },
   { "paragraph-indent", 1, 0, 'p' },




reply via email to

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