[Po4a-commits] r2347 - /trunk/po4a
barbier-guest at users.alioth.debian.org
barbier-guest at users.alioth.debian.org
Mon Nov 22 21:49:01 UTC 2010
Author: barbier-guest
Date: Mon Nov 22 21:49:01 2010
New Revision: 2347
URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2347
Log:
Allow [...] commands without arguments in cfg files
The main use is to allow
[po4a_langs]
[po4a_paths] po4a/po/foo.pot $lang:po4a/po/$lang.po
Of course this is not recommended, one should write
[po_directory] po4a/po
instead, but the configuration snippet above should work.
Modified:
trunk/po4a
Modified: trunk/po4a
URL: http://svn.debian.org/wsvn/po4a/trunk/po4a?rev=2347&op=diff
==============================================================================
--- trunk/po4a (original)
+++ trunk/po4a Mon Nov 22 21:49:01 2010
@@ -794,9 +794,11 @@
next if ($line =~ s/\\$//);
next unless ($line =~ /\S/);
+ my $args = $line;
die wrap_ref_mod("$config_file:$nb", "", gettext("Syntax error: %s"), $line)
- unless ($line =~ m/^\[([^\]]*)\] (\S+) (.*)$/ || $line =~ m/^\[([^\]]*)\] (\S+)$/);
- my ($cmd,$main,$args)=($1,$2,$3||"");
+ unless ($args =~ s/^\[([^\]]*)\] *//);
+ my $cmd = $1;
+ my $main = ($args=~ s/^(\S+) *// ? $1 : "");
if (@langs) {
# Expand the $lang templates
@@ -828,7 +830,7 @@
die wrap_ref_mod("$config_file:$nb", "",
gettext("Unparsable argument '%s'."), $arg)
unless ($arg =~ /^([^:]*):(.*)/);
- $po_filename{$1}=$2;
+ $po_filename{$1}=$2 if $1 ne '$lang';
}
} elsif ($cmd eq "po4a_langs") {
More information about the Po4a-commits
mailing list