[Po4a-devel] Re: po4a - Sgml

Nicolas François nicolas.francois at centraliens.net
Tue Nov 15 15:58:41 UTC 2005


Hello,

Thomas contacted me (one more time, thanks) about an issue on the Sgml
module (but Alioth was down - one more time...;).

The problem occurs with the maint-guide.sgml file.
This file contains a prolog antity:
<!ENTITY % default  SYSTEM "default.ent">  %default;

When po4a-normalized, the content of this entity is re-wrapped on one
line (which is probably not an issue, but render the generated document
less readable).


There is a comment arround line 550 (when the entity is read):
# leave those damn references in peace by making sure it fits on one line
Then, all the end of lines are replaced by spaces.

This is the origin of the problem.
I think this comment is wrong. We don't have to keep the references in the
prolog. This prolog is translated separately ($prolog is translated, not
$orig_file). There are no references for the prolog strings in the PO.

Thus, I'll simplify the code and keep the newlines.
(I also use tr/\n/\n/ to count the number of lines instead of spliting on
newlines, which is faster).

I will soon commit a patch. It differs from Thomas' one (attached) - I
preferred to fix it earlier in the code.

This is mostly for the record (the above explanation is too long for a CVS
commit message). Thomas' mail is in French, and is summarized above.
(Anybody interrested in a Mail module ?)

On Mon, Nov 14, 2005 at 02:34:25PM +0100, Thomas Huriaux wrote:
> Salut,
> 
> Je ne sais pas pourquoi mais alioth est complètement inacessible de là
> où je suis, donc je t'envoie directement ce mail, tu feras suivre si
> nécessaire.
> 
> Le problème a été trouvé avec le maint-guide.sgml avec des retours à la
> ligne manquant, le diff corrige le problème pour ce fichier, mais en
> génère peut-être d'autres ailleurs.
> En particulier, la suppression du $self->pushline($1) if length($1); est
> peut-être un peu trop radicale.
> 
> -- 
> Thomas Huriaux

> Index: lib/Locale/Po4a/Sgml.pm
> ===================================================================
> RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
> retrieving revision 1.82
> diff -u -r1.82 Sgml.pm
> --- lib/Locale/Po4a/Sgml.pm	30 Oct 2005 16:42:11 -0000	1.82
> +++ lib/Locale/Po4a/Sgml.pm	14 Nov 2005 13:29:34 -0000
> @@ -745,8 +745,7 @@
>          $prolog=$2;					       
>          my ($post) = $3;			
>          while ($prolog =~ m/^(.*?)<!ENTITY\s+(\S*)\s+"([^"]*)">(.*)$/is) { #" ){ 
> -	   $self->pushline($1) if length($1);
> -	   $self->pushline("<!ENTITY $2 \"".$self->translate($3,"","definition of entity \&$2;")."\">");
> +	   $self->pushline("<!ENTITY $2 \"".$self->translate($3,"","definition of entity \&$2;")."\">\n");
>  	   warn "Seen text entity $2\n" if ($debug{'entities'});
>  	   $prolog = $4;
>  	}

Kind Regards,
-- 
Nekral




More information about the Po4a-devel mailing list