Skip to content

Commit

Permalink
TeX: Don't use the full absolute file path in #: references of PO files
Browse files Browse the repository at this point in the history
  • Loading branch information
mquinson committed Nov 6, 2021
1 parent 163d044 commit b0f1df3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ po4a runner:
* Rename the option 'master:file' to 'pot' for clarity. The old name
still works (with a warning).

Tex:
* Don't use the full absolute file path in #: references of PO files.
(Debian's #998196)

Translations:
* Updated: Croatian, thanks Milo Ivir.
* Updated: German, thanks Helge Kreutzmann.
Expand Down
8 changes: 5 additions & 3 deletions lib/Locale/Po4a/TeX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -931,11 +931,12 @@ Overloads Transtractor's read().
sub read {
my $self = shift;
my $filename = shift;
my $refname = shift;

# keep the directory name of the main file.
$my_dirname = dirname($filename);

push @{ $self->{TT}{doc_in} }, read_file( $self, $filename );
push @{ $self->{TT}{doc_in} }, read_file( $self, $filename, $refname );
}

=item B<read_file>
Expand All @@ -954,14 +955,15 @@ sub read_file {
my $self = shift;
my $filename = shift
or croak wrap_mod( "po4a::tex", dgettext( "po4a", "Cannot read from file without having a filename" ) );
my $refname = shift // $filename;
my $linenum = 0;
my @entries = ();

open( my $in, $filename )
or croak wrap_mod( "po4a::tex", dgettext( "po4a", "Cannot read from %s: %s" ), $filename, $! );
while ( defined( my $textline = <$in> ) ) {
$linenum++;
my $ref = "$filename:$linenum";
my $ref = "$refname:$linenum";

# TODO: add support for includeonly
# The next regular expression matches \input or \includes that are
Expand Down Expand Up @@ -999,7 +1001,7 @@ sub read_file {
die wrap_mod( "po4a::tex", dgettext( "po4a", "Cannot find %s with kpsewhich" ), $filename );
}

push @entries, read_file( $self, $newfilepath );
push @entries, read_file( $self, $newfilepath, $newfilename );
if ( $tag eq "include" ) {
$textline = "\\clearpage" . $end;
} else {
Expand Down

0 comments on commit b0f1df3

Please sign in to comment.