[Po4a-commits] "po4a/lib/Locale/Po4a Xml.pm,1.77,1.78"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sun Nov 2 14:44:25 UTC 2008


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory alioth:/tmp/cvs-serv13004/lib/Locale/Po4a

Modified Files:
	Xml.pm 
Log Message:
	* lib/Locale/Po4a/Xml.pm: Added support for module options
	_default_translated and _default_untranslated.
	* lib/Locale/Po4a/Xml.pm: Simplify the handling of options.


Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- Xml.pm	4 Oct 2008 12:38:02 -0000	1.77
+++ Xml.pm	2 Nov 2008 14:44:23 -0000	1.78
@@ -368,6 +368,8 @@
 	}
 	# Default options set by modules. Forbidden for users.
 	$self->{options}{'_default_tags'}='';
+	$self->{options}{'_default_translated'}='';
+	$self->{options}{'_default_untranslated'}='';
 	$self->{options}{'_default_inline'}='';
 
 	#It will maintain the list of the translatable tags
@@ -1527,50 +1529,55 @@
 sub treat_options {
 	my $self = shift;
         
-	$self->{options}{'nodefault'} =~ /\s*(.*)\s*/s;
+	$self->{options}{'nodefault'} =~ /^\s*(.*)\s*$/s;
 	my %list_nodefault;
 	foreach (split(/\s+/s,$1)) {
 		$list_nodefault{$_} = 1;
 	}
 	$self->{nodefault} = \%list_nodefault;
 
-	my @list_tags;
-	$self->{options}{'tags'} =~ /\s*(.*)\s*/s;
-	foreach my $tag (split(/\s+/s,$1)) {
-		push @list_tags, $tag;
-	}
-	$self->{options}{'_default_tags'} =~ /\s*(.*)\s*/s;
+	$self->{options}{'tags'} =~ /^\s*(.*)\s*$/s;
+	my @list_tags = split(/\s+/s,$1);
+	$self->{options}{'_default_tags'} =~ /^\s*(.*)\s*$/s;
 	foreach my $tag (split(/\s+/s,$1)) {
 		push @list_tags, $tag
 			unless $list_nodefault{$tag};
 	}
 	$self->{tags} = \@list_tags;
 
-	$self->{options}{'translated'} =~ /\s*(.*)\s*/s;
+	$self->{options}{'translated'} =~ /^\s*(.*)\s*$/s;
 	my @list_translated = split(/\s+/s,$1);
+	$self->{options}{'_default_translated'} =~ /^\s*(.*)\s*$/s;
+	foreach my $tag (split(/\s+/s,$1)) {
+		push @list_translated, $tag
+			unless $list_nodefault{$tag};
+	}
 	$self->{translated} = \@list_translated;
 
-	$self->{options}{'untranslated'} =~ /\s*(.*)\s*/s;
+	$self->{options}{'untranslated'} =~ /^\s*(.*)\s*$/s;
 	my @list_untranslated = split(/\s+/s,$1);
+	$self->{options}{'_default_untranslated'} =~ /^\s*(.*)\s*$/s;
+	foreach my $tag (split(/\s+/s,$1)) {
+		push @list_untranslated, $tag
+			unless $list_nodefault{$tag};
+	}
 	$self->{untranslated} = \@list_untranslated;
 
-	$self->{options}{'attributes'} =~ /\s*(.*)\s*/s;
+	$self->{options}{'attributes'} =~ /^\s*(.*)\s*$/s;
 	my @list_attr = split(/\s+/s,$1);
 	$self->{attributes} = \@list_attr;
 
 	my @list_inline;
-	$self->{options}{'inline'} =~ /\s*(.*)\s*/s;
+	$self->{options}{'inline'} =~ /^\s*(.*)\s*$/s;
+	@list_inline = split(/\s+/s,$1);
+	$self->{options}{'_default_inline'} =~ /^\s*(.*)\s*$/s;
 	foreach my $tag (split(/\s+/s,$1)) {
 		push @list_inline, $tag
 			unless $list_nodefault{$tag};
 	}
-	$self->{options}{'_default_inline'} =~ /\s*(.*)\s*/s;
-	foreach my $tag (split(/\s+/s,$1)) {
-		push @list_inline, $tag;
-	}
 	$self->{inline} = \@list_inline;
 
-	$self->{options}{'placeholder'} =~ /\s*(.*)\s*/s;
+	$self->{options}{'placeholder'} =~ /^\s*(.*)\s*$/s;
 	my @list_placeholder = split(/\s+/s,$1);
 	$self->{placeholder} = \@list_placeholder;
 }




More information about the Po4a-commits mailing list