[Top][All Lists]

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

Re: Transforming XML or other intermediate representation of Texinfo; ca

From: Patrice Dumas
Subject: Re: Transforming XML or other intermediate representation of Texinfo; category system
Date: Thu, 16 Dec 2021 18:55:53 +0100

On Wed, Dec 15, 2021 at 09:20:32PM -0800, Robert Dodier wrote:
> Hi Patrice, thanks a lot for your message.
> I looked into the possibility of a Texinfo --> Texinfo XML -->
> mogrifications --> Texinfo pipeline, but it looks like it's not going
> to work. The translation from Texinfo to XML is lossy -- any
> @ifsomething blocks are lost for something != xml.

That could be workaround with --if* on the command line, maybe for each
output format, and --no-ifxml?

> Likewise the
> translation from XML back to Texinfo is lossy -- there doesn't appear
> to be a way to recover macros which are present in the original
> Texinfo and for which I can generate an XML tag; the XML tag (e.g.
> <foo>bar</foo>) doesn't emit anything in the reconstituted Texinfo
> (@foo{bar} would be ideal, but anyway, nothing is generated).

Indeed, @macro defined @-commands, @value{} and @include are expanded and
cannot be recovered.  However, it is not clear to me why you would want
to keep those, maybe I missed something about your need.  See below an
example, the unexpanded @macro defined @-commands/@value{}/@include may
make the Texinfo not well structured.

> Given that, I can't see a way to treat Texinfo XML as an intermediate
> representation of a document, suitable for transformations, except for
> restricted-enough documents.
> No fault on your part, I don't mean to assign blame or responsibility
> or whatever, just saying that it's too bad, I can't figure out a way
> to make it work. Thanks for your help all the same, I appreciate it.

There is a long term plan to make recoverable @macro defined @-commands,
@value{} and @include too, but it is challenging, so it should take
time.  It also may not be suitable for your need, as @macro defined
@-command may lead to invalid XML, as those defined @-command may be
used to generate well balanced Texinfo but not be well balanced.  For

 @macro foo {}
 @end macro

 example text
 @end example

It probably does not work in texi2pdf, though.  The plan is more to keep
the information in the intermediate tree in perl, but not directly in
the regular tree, but as additional informations, as the @macro defined
@-command may not follow the tree structure that the final Texinfo document,
obtained after @macro defined @-command expansion always follows.


reply via email to

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