[Po4a-devel]Re: [Po4a-commits] po4a/lib/Locale/Po4a Sgml.pm,1.34,1.35

Jordi Vilalta jvprat@wanadoo.es
Mon, 16 Aug 2004 02:32:31 +0200 (CEST)


Hi,

On Sat, 14 Aug 2004, Martin Quinson wrote:
...
> I guess we should try to extract the reference recomputation and file
> inclusion out of Sgml.pm to TransTractor, and see if the problem still
> occure in Xml.pm, for example.
>
> The prototype of the function in TT should be:
>
> includefile($pre,$filename,$post);
>
> so that "bliblu<include href="toto"/>blobla" can be dealt with properly.
>
> The action would be to open the file in a @variable, generate the
> corresponding references ("refinmainfile:33 refinnewfile:44", first one=ref
> at which we found the inclusion request, second naturally incrementing the
> line number), and then unshiftline() all lines (begining with the last one)
> of the @variable into the document.

I think we also need to pass the original line reference.

And the pre and post shouldn't be mandatory, there may be many formats 
that include a file as whole lines. We should put these options as a hash.

Also, there can be some places where it could be interesting to have the 
file to insert in a separate array (like in handling the doctype tag in 
the Xml module), so I propose creating a more low level function that 
reads the file into an array, and then this includefile which inserts it 
directly to the input document and handles the pre/post.

Regards,

Jordi Vilalta