--- Man.pm.orig 2004-11-17 19:48:11.000000000 +0100 +++ Man.pm 2004-11-17 21:59:30.000000000 +0100 @@ -246,8 +246,6 @@ # . - a single char (e.g. B, I, R, P, 1, 2, 3, 4, etc.) my $FONT_RE = "\\\\f(?:\\[[^\\]]*\\]|\\(..|[^\\(\\[])"; -sub initialize {} - ######################### #### DEBUGGING STUFF #### ######################### @@ -275,6 +273,46 @@ # end of file return ($line,$ref); } +REIGN: +my $dir='~/sources/po4a/cvs/po4a/testsuite/ignore/'; +opendir DIR, $dir; +while (my $file= readdir DIR) { + if (-T "$dir/$file") { + open(IGNORE, "$dir/$file") + or die "Can't open file"; + my @lines=; + close(IGNORE); + my @tmp=(); # Keep the shifted strings in case they doen't match the file + my $test=shift(@lines); + while (defined $line and defined $test and $test eq $line) { + push(@tmp, ($line,$ref)); + ($line,$ref) = $self->SUPER::shiftline(); + $test = shift(@lines); + } + if (defined $test) { + # restore the lines + while (@tmp) { + $self->SUPER::unshiftline($line, $ref); + $ref = pop(@tmp); + $line = pop(@tmp); + } + } else { + print "<$file\n"; + while (@tmp) { + # This part is just copied as is, no translation needed + my ($l,$r)=(shift(@tmp),shift(@tmp)); + $self->pushline($l); + } + if(! defined $line) { + # both reached the end + return ($line,$ref); + } + goto REIGN; + } + } +} + + # Handle some escapes # * reduce the number of \ in macros @@ -1436,3 +1474,40 @@ ### this from the generated manpage, and declare our own header ### $macro{'UC'}=$macro{'AT'}=\&untranslated; + + + + +sub initialize { + my $self = shift; + my %options = @_; + + $self->{options}{'translate'}=''; + $self->{options}{'verbatim'}=''; + $self->{options}{'debug'}=''; + + foreach my $opt (keys %options) { + if ($options{$opt}) { + die sprintf("po4a::sgml: ".dgettext ("po4a","Unknown option: %s"), $opt)."\n" unless exists $self->{options}{$opt}; + $self->{options}{$opt} = $options{$opt}; + } + } + if ($options{'verbatim'}) { + foreach (split(/,/, $options{'verbatim'})) { + print "verbatim'$_'\n"; + $macro{$_}=\&untranslated; + } + } + if ($options{'translate'}) { + foreach (split(/,/, $options{'translate'})) { + $macro{$_}=\&translate_joined; + } + } + if ($options{'debug'}) { + foreach ($options{'debug'}) { + $debug{$_} = 1; + } + } +} + +