[Po4a-commits] "po4a/lib/Locale/Po4a Xml.pm, 1.95, 1.96 Docbook.pm, 1.33, 1.34 Guide.pm, 1.15, 1.16 Xhtml.pm, 1.16, 1.17"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sat Feb 28 23:29:28 UTC 2009


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

Modified Files:
	Xml.pm Docbook.pm Guide.pm Xhtml.pm 
Log Message:
	* lib/Locale/Po4a/Docbook.pm, lib/Locale/Po4a/Guide.pm,
	lib/Locale/Po4a/Xhtml.pm: Use _default_attributes instead of
	attributes.
	* lib/Locale/Po4a/Xml.pm: Added support for _default_attributes.
	* lib/Locale/Po4a/Xml.pm: Do not use the default setting if the
	tag is already assigned to the category on the command line
	(modifiers may differ).


Index: Docbook.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Docbook.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- Docbook.pm	22 Feb 2009 10:20:31 -0000	1.33
+++ Docbook.pm	28 Feb 2009 23:29:26 -0000	1.34
@@ -212,7 +212,7 @@
 	# NOTE: the attributes might be translated
 	$self->{options}{'_default_translated'} .= " <audiodata>";
 	$self->{options}{'_default_placeholder'} .= " <audiodata>";
-	$self->{options}{'attributes'}.=' <audiodata>fileref';
+	$self->{options}{'_default_attributes'}.=' <audiodata>fileref';
 
 	# audioobject; does not contain text;
 	# NOTE: might be contaioned in a inlinemediaobject
@@ -765,7 +765,7 @@
 	# v4, not in v5
 	$self->{options}{'_default_untranslated'} .= " <graphic>";
 	$self->{options}{'_default_inline'} .= " <graphic>";
-	$self->{options}{'attributes'}.=' <graphic>fileref';
+	$self->{options}{'_default_attributes'}.=' <graphic>fileref';
 
 	# graphicco; does not contain text; Formatted as a displayed block.
 	# v4, not in v5
@@ -861,7 +861,7 @@
 	# as a displayed block, depending on context
 	$self->{options}{'_default_translated'} .= " <imagedata>";
 	$self->{options}{'_default_inline'} .= " <imagedata>";
-	$self->{options}{'attributes'}.=' <imagedata>fileref';
+	$self->{options}{'_default_attributes'}.=' <imagedata>fileref';
 
 	# imageobject; does not contain text; May be formatted inline or
 	# as a displayed block, depending on context
@@ -1859,7 +1859,7 @@
 	# NOTE: could be in the inline class
 	$self->{options}{'_default_untranslated'} .= " <textdata>";
 	$self->{options}{'_default_break'} .= " <textdata>";
-	$self->{options}{'attributes'}.=' <textdata>fileref';
+	$self->{options}{'_default_attributes'}.=' <textdata>fileref';
 
 	# textobject; does not contain text; Formatted inline or as a displayed block
 	# NOTE: could be in the inline class
@@ -1994,7 +1994,7 @@
 	# videodata; contains text; Formatted inline or as a displayed block
 	$self->{options}{'_default_untranslated'} .= " <videodata>";
 	$self->{options}{'_default_break'} .= " <videodata>";
-	$self->{options}{'attributes'}.=' <videodata>fileref';
+	$self->{options}{'_default_attributes'}.=' <videodata>fileref';
 
 	# videoobject; contains text; Formatted inline or as a displayed block
 	$self->{options}{'_default_untranslated'} .= " <videoobject>";
@@ -2032,7 +2032,7 @@
 
 # ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
-	$self->{options}{'attributes'}.='
+	$self->{options}{'_default_attributes'}.='
 		lang
 		xml:lang';
 

Index: Guide.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Guide.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Guide.pm	22 Feb 2009 10:20:31 -0000	1.15
+++ Guide.pm	28 Feb 2009 23:29:26 -0000	1.16
@@ -119,7 +119,7 @@
 		<var>
 		<version>
 		w<warn>';
-	$self->{options}{'attributes'}.='
+	$self->{options}{'_default_attributes'}.='
 		<author>title
 		<figure>caption
 		<figure>link

Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- Xml.pm	22 Feb 2009 15:20:48 -0000	1.95
+++ Xml.pm	28 Feb 2009 23:29:26 -0000	1.96
@@ -381,6 +381,10 @@
 =back
 
 =cut
+# TODO: defaulttranslateoption
+# w => indicate that it is only valid for translatable tags and do not
+#      care about inline/break/placeholder?
+# ...
 
 sub initialize {
 	my $self = shift;
@@ -471,9 +475,10 @@
   $self->treat_options;
 
 You should use the B<_default_inline>, B<_default_break>,
-B<_default_placeholder>, B<_default_translated>, B<_default_untranslated>
-options in derivated modules. This allow users to override the default
-behavior defined in your module with command line options.
+B<_default_placeholder>, B<_default_translated>, B<_default_untranslated>,
+and B<_default_attributes> options in derivated modules. This allow users
+to override the default behavior defined in your module with command line
+options.
 
 =head2 OVERRIDING THE found_string FUNCTION
 
@@ -1642,7 +1647,8 @@
 	foreach my $tag (split(/\s+/s,$1)) {
 		$tag =~ m/^(.*?)(<.*)$/;
 		$self->{break}->{$2} = $1 || ""
-			unless $list_nodefault{$tag};
+			unless    $list_nodefault{$tag}
+			       or defined $self->{break}->{$2};
 	}
 
 	$self->{options}{'translated'} =~ /^\s*(.*)\s*$/s;
@@ -1654,7 +1660,8 @@
 	foreach my $tag (split(/\s+/s,$1)) {
 		$tag =~ m/^(.*?)(<.*)$/;
 		$self->{translated}->{$2} = $1 || ""
-			unless $list_nodefault{$tag};
+			unless    $list_nodefault{$tag}
+			       or defined $self->{translated}->{$2};
 	}
 
 	$self->{options}{'untranslated'} =~ /^\s*(.*)\s*$/s;
@@ -1666,7 +1673,8 @@
 	foreach my $tag (split(/\s+/s,$1)) {
 		$tag =~ m/^(.*?)(<.*)$/;
 		$self->{untranslated}->{$2} = $1 || ""
-			unless $list_nodefault{$tag};
+			unless    $list_nodefault{$tag}
+			       or defined $self->{untranslated}->{$2};
 	}
 
 	$self->{options}{'attributes'} =~ /^\s*(.*)\s*$/s;
@@ -1677,6 +1685,18 @@
 			$self->{attributes}->{$tag} = "";
 		}
 	}
+	$self->{options}{'_default_attributes'} =~ /^\s*(.*)\s*$/s;
+	foreach my $tag (split(/\s+/s,$1)) {
+		if ($tag =~ m/^(.*?)(<.*)$/) {
+			$self->{attributes}->{$2} = $1 || ""
+				unless    $list_nodefault{$2}
+				       or defined $self->{attributes}->{$2};
+		} else {
+			$self->{attributes}->{$tag} = ""
+				unless    $list_nodefault{$tag}
+				       or defined $self->{attributes}->{$tag};
+		}
+	}
 
 	my @list_inline;
 	$self->{options}{'inline'} =~ /^\s*(.*)\s*$/s;
@@ -1688,7 +1708,8 @@
 	foreach my $tag (split(/\s+/s,$1)) {
 		$tag =~ m/^(.*?)(<.*)$/;
 		$self->{inline}->{$2} = $1 || ""
-			unless $list_nodefault{$tag};
+			unless    $list_nodefault{$tag}
+			       or defined $self->{inline}->{$2};
 	}
 
 	$self->{options}{'placeholder'} =~ /^\s*(.*)\s*$/s;
@@ -1700,7 +1721,8 @@
 	foreach my $tag (split(/\s+/s,$1)) {
 		$tag =~ m/^(.*?)(<.*)$/;
 		$self->{placeholder}->{$2} = $1 || ""
-			unless $list_nodefault{$tag};
+			unless    $list_nodefault{$tag}
+			       or defined $self->{placeholder}->{$2};
 	}
 
 	# There should be no translated and untranslated tags

Index: Xhtml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xhtml.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Xhtml.pm	22 Feb 2009 21:58:24 -0000	1.16
+++ Xhtml.pm	28 Feb 2009 23:29:26 -0000	1.17
@@ -219,7 +219,7 @@
         # If you choose to translate images, you may also want to set
         # <map> as placeholder and <area> as inline.
 
-        $self->{options}{'attributes'}.='
+        $self->{options}{'_default_attributes'}.='
                 alt
                 lang
                 title




More information about the Po4a-commits mailing list