[Po4a-commits] "po4a/lib/Locale/Po4a Man.pm,1.145,1.146"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sat Jun 3 22:41:53 UTC 2006


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

Modified Files:
	Man.pm 
Log Message:
Add a generated option (allow po4a to work on generated man pages).


Index: Man.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Man.pm,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- Man.pm	3 Jun 2006 22:03:13 -0000	1.145
+++ Man.pm	3 Jun 2006 22:41:51 -0000	1.146
@@ -195,6 +195,13 @@
 I<foo E<lt>.bar baz quxE<gt> quux>, where I<foo> is the command that
 should be inlined.
 
+=item generated
+
+This option specifies that the file was generated, and that po4a should not
+try to detect if the man pages was generated from another format.
+This permits to use po4a on generated man pages.
+This option does not take any argument.
+
 =back
 
 =head1 AUTHORING MAN PAGES COMPLIANT WITH PO4A::MAN
@@ -397,6 +404,9 @@
 );
 my %inline = (
 );
+# This variable indicates whether po4a should try to detect the generated
+# files.
+my $allow_generated = 0;
 sub initialize {
     my $self = shift;
     my %options = @_;
@@ -410,6 +420,7 @@
     $self->{options}{'translate_each'}='';
     $self->{options}{'no_wrap'}='';
     $self->{options}{'inline'}='';
+    $self->{options}{'generated'}='';
 
     # reset the debug options
     %debug = ();
@@ -472,6 +483,9 @@
             $inline{$_} = 1;
         }
     }
+    if (defined $options{'generated'}) {
+        $allow_generated = 1;
+    }
 }
 
 my @comments = ();
@@ -519,6 +533,7 @@
     if ($line =~ m/^(.*?)(?:(?<!\\)\\(["#])(.*))$/) {
         my ($l, $t, $c) = ($1, $2, $3);
         $line = $l;
+        unless ($allow_generated) {
         # Check for comments indicating that the file was generated.
         if ($c =~ /Pod::Man/) {
             warn wrap_mod("po4a::man", dgettext("po4a", "This file was generated with Pod::Man. Translate the pod file with the pod module of po4a."));
@@ -551,6 +566,7 @@
                 "You should translate the source file, but continuing anyway."
                 ),$l."\\\"".$c);
         }
+        }
 
         if ($line =~ m/^[.']*$/) {
             if ($c !~ m/^\s*$/) {




More information about the Po4a-commits mailing list