aboutsummaryrefslogtreecommitdiffstats
path: root/Perl
diff options
context:
space:
mode:
authorThomas Lange <lange@debian.org>2023-09-20 14:56:17 +0200
committerThomas Lange <lange@debian.org>2023-09-20 14:56:17 +0200
commit145afba3acc8c324b54fde8942f287d28a403ab1 (patch)
treefe083aa7e57139a8cc283a4238d35f5c92b81092 /Perl
parentf3ef3a31e34e624dca1d7b1836b5a89358d22608 (diff)
add support for Perl regex in the global .transignore file
You can use all types of Perl regex local .transignore files in subdirectories are no needed any more
Diffstat (limited to 'Perl')
-rw-r--r--Perl/Webwml/TransIgnore.pm17
1 files changed, 12 insertions, 5 deletions
diff --git a/Perl/Webwml/TransIgnore.pm b/Perl/Webwml/TransIgnore.pm
index a06f987ff87..55d3812633b 100644
--- a/Perl/Webwml/TransIgnore.pm
+++ b/Perl/Webwml/TransIgnore.pm
@@ -1,6 +1,7 @@
#!/usr/bin/perl
## Copyright (C) 2001 Denis Barbier <barbier@debian.org>
+## Copyright (C) 2023 Thomas Lange <lange@debian.org>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -70,12 +71,16 @@ sub new
# Read global .transignore file
$self->_read($root);
+ my @regex;
# remove the root path from the front of the files
for (0 .. $#{$self->{LOCAL}})
{
- ${$self->{LOCAL}}[$_] =~ s{^$root/}{};
+ ${$self->{LOCAL}}[$_] =~ s{^$root/}{};
+ push @regex, qr/${$self->{LOCAL}}[$_]/;
}
- $self->{GLOBAL} = $self->{LOCAL};
+
+ # global patterns are regex
+ $self->{GLOBAL} = \@regex;
# reinitialize $self->{LOCAL}
$self->{LOCAL} = [];
@@ -138,7 +143,7 @@ sub local
=item global
-Return the list of files defined
+Return the list of regex defined
my @ignore = $ti->global();
@@ -184,18 +189,20 @@ sub is_global
my $self = shift;
my $entry = shift;
- foreach my $file ( @{$self->{GLOBAL}} )
+ foreach my $regex ( @{$self->{GLOBAL}} )
{
- return 1 if $file eq $entry;
+ return 1 if $entry =~ m/$regex/;
}
return 0;
}
+
=back
=head1 AUTHOR
Copyright (C) 2001 Denis Barbier <barbier@debian.org>
+Copyright (C) 2023 Thomas Lange <lange@debian.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

© 2014-2024 Faster IT GmbH | imprint | privacy policy