[Po4a-devel] Problems with Docbook/Xml module

Nicolas François nicolas.francois at centraliens.net
Fri Oct 21 19:14:13 UTC 2005


Hi Thomas,

On Fri, Oct 21, 2005 at 12:06:06PM +0200, thomas.huriaux at kti.ae.poznan.pl wrote:
> Hi,
> 
> I'm currently trying to use po4a for the aptitude documentation, and
> here are the few problems I have:
> * if there is a comment in a sentence such as
>          In the <!-- TODO: <link linkend='secHier'>
>          -->hierarchy editor, stores the hierarchy location
>   then the result will be:
>          msgid "In the"
> 	 msgstr ""
> 
> 	 msgid "hierarchy editor, stores the hierarchy location"
> 	 msgstr ""

Can anyone check the attached patch?
It makes the comments non-breaking, and just removes them from the
paragraphs.

> * the <screen> tag in Docbook must be set as translatable and "no-wrap"
>   It is easy to fix in Docbook.pm, please just add in the tags option:
> 	+               W<screen>

Done. Thanks.

> * if there is a footnote, such as
> 	<para>
> 	  Begining of the sentence
> 	    <footnote><para>footnote text</para></footnote>
> 	  end of the sentence.
> 	</para>
>   then once again it will be divided into three strings:
>         msgid "Begining of the sentence"
> 	msgid "footnote text"
> 	msgid "end of the sentence."
> 
>   I'm afraid that for this last problem, there is no easy solution and
>   we will have to keep the current situation.

There must be a way to indicate that the footnote tag should never be
separated from its paragraph.

However, it is not perfect (because you will want to extract the footnot
if it appear at the end of a paragraph).

The TeX module uses the following method: if the tag appears at the end of
a bloc, it is extracted, otherwise, we let the tag inlined in the
paragraph.

> * In the Debian package, there is still the encoding problem in the xml
>   header, which has been fixed in the CVS version. I'm waiting for a new
>   release :-)

seconded ;)

Kind Regards,
-- 
Nekral
-------------- next part --------------
Index: lib/Locale/Po4a/Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.28
diff -u -r1.28 Xml.pm
--- lib/Locale/Po4a/Xml.pm	30 May 2005 07:05:23 -0000	1.28
+++ lib/Locale/Po4a/Xml.pm	21 Oct 2005 18:45:05 -0000
@@ -347,7 +347,7 @@
 my @tag_types = ( 
 	{	beginning	=> "!--",
 		end		=> "--",
-		breaking	=> 1,
+		breaking	=> 0,
 		f_extract	=> \&tag_extract_comment,
 		f_translate	=> \&tag_trans_comment},
 	{	beginning	=> "?xml",
@@ -830,10 +830,22 @@
 
 	while (!$eof and !$self->breaking_tag) {
 		my @text;
-		# Append the found inline tag
-		($eof, at text)=$self->get_string_until('>',{include=>1,remove=>1,unquoted=>1});
-		push @paragraph, @text;
+		my $type = $self->tag_type;
+		my $f_extract = $tag_types[$type]->{'f_extract'};
+		if (    defined($f_extract)
+		    and $f_extract eq \&tag_extract_comment) {
+			# Remove the content of the comments
+			($eof, @text) = $self->extract_tag($type,1);
+		} else {
+			# Append the found inline tag
+			($eof, at text)=$self->get_string_until('>',
+			                                     {include=>1,
+			                                      remove=>1,
+			                                      unquoted=>1});
+			push @paragraph, @text;
+		}
 
+		# Next tag
 		($eof, at text)=$self->get_string_until('<',{remove=>1});
 		if ($#text > 0) {
 			push @paragraph, @text;


More information about the Po4a-devel mailing list