[Po4a-commits] po4a/lib/Locale/Po4a Man.pm,1.68,1.69 Po.pm,1.29,1.30

Nicolas FRAN??OIS po4a-devel@lists.alioth.debian.org
Sat, 27 Nov 2004 01:08:58 +0000


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv7251/lib/Locale/Po4a

Modified Files:
	Man.pm Po.pm 
Log Message:
Fix an issue with paragraphs starting by a new line.
This was triggered by a (very) few man pages (containing paragraphs
starting by a .BR without argument or a font modifier without anything on
the line), but it is probably not man specific.


Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- Po.pm	5 Nov 2004 20:33:51 -0000	1.29
+++ Po.pm	27 Nov 2004 01:08:56 -0000	1.30
@@ -1057,7 +1057,7 @@
     my @lines=split(/\n/,"$text");
     my $res="";
     my $first=1;
-    while (my $line=shift @lines) {
+    while (defined(my $line=shift @lines)) {
 	if ($first && length($line) > $col - 10) {
 	    unshift @lines,$line;
 	    $first=0;

Index: Man.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Man.pm,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- Man.pm	19 Nov 2004 22:01:42 -0000	1.68
+++ Man.pm	27 Nov 2004 01:08:56 -0000	1.69
@@ -413,6 +413,15 @@
         set_regular("R");
     }
 
+    # After the simplification, the first char can be a \n.
+    # Simply push these newlines before the translation, but make sure the
+    # resulting string is not empty (or an additionnal line will be
+    # added).
+    if ($str =~ /^(\n+)(.+)$/s) {
+        $self->pushline($1);
+        $str = $2;
+    }
+
     # Kill minus sign/hyphen difference.
     # Aestetic of printed man pages may suffer, but:
     #  * they are translator-unfriendly