[Po4a-devel][RFC] Multi-lines verbatim blocks

Nicolas François nicolas.francois@centraliens.net
Mon, 15 Nov 2004 23:55:31 +0100


Hello,

To solve an issue with the man module, I've implemented a way to specify
some (multi-lines) verbatim blocks.
I'm wondering if this functionality has an interest for po4a users (it
may be error prone), and if it can be useful for other modules (in this
case it should be implemented in Transtractor).



The major cause (50%) of failure of the man module (po4a exits with an
error message) concerns blocks in roff language (using .de, .if, .ie or
.el requests).
They are usually used to define new macros or different ways to do the
same thing depending on the parser (e.g. nroff or troff).


Copying these block of code from the original to the translation is
particularly useful for the man module because the roff language is quite
complicated, which pushed authors to just cut & past definitions found in
other pages (a lot of the defined macros are not even used).

With my first try, I could correctly process 60 additional files (without
even defining additional macros). 25 different blocks were used (each one
defined in a file).


Everything is not so neat:
  - if the block appear in the middle of a paragraph, the block will be
    copied verbatim at a wrong place: at the beginning of the paragraph
    (this could be fixed by adding a function to "flush" the parser).
    Most of the time, it is not a concern because the macros are defined
    in the header and it is up to the user to specify or not a verbatim
    block, but it should probably be fixed.
  - it makes po4a slower (I don't think it's an issue, except for the
    testsuite;): each lines of the input document has to be compared with
    a line of each specified files (and lines have to be shifted/unshifted
    many times).
  - the user can do whatever he wants and it is, as the addendums, a quite
    complicated feature which can be error prone.
  - ...


Do you think it may be worth having such a mechanism in po4a?
Is there an interest for the other modules?


Note:
For the man module, I'm also planing to add a verbatim and translate
option (like in the sgml module), which should allow to specify the
behaviour of the parser for these additional macros.

Another Note:
I've not tried this, but it may solve #263298 (Please let -gettextize know
about addendums and remove them automatically).


Kind Regards,
-- 
Nekral