[Po4a-devel][CVS] po4a/lib/Locale/Po4a Sgml.pm,1.18,1.19

Martin Quinson po4a-devel@lists.alioth.debian.org
Tue, 25 May 2004 16:59:57 +0000


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv26429

Modified Files:
	Sgml.pm 
Log Message:
Add a 'include-all' module option

Index: Sgml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- Sgml.pm	30 Apr 2004 22:47:58 -0000	1.18
+++ Sgml.pm	25 May 2004 16:59:55 -0000	1.19
@@ -73,7 +73,14 @@
 
 =item force
 
+Proceed even if the DTD is unknown.
+
+=item include-all
 
+By default, msgid containing only one entity (like '&version') are skipped
+for the translator comfort. Activating this option prevents this
+optimisation. It can be useful if the document contains a construction like
+"<title>&Acute;</title>", even if I doubt such things to ever happen...
 
 =head1 STATUS OF THIS MODULE
 
@@ -185,6 +192,8 @@
     $self->{options}{'verbatim'}='';
     $self->{options}{'ignore'}='';
 
+    $self->{options}{'include-all'}='';
+
     $self->{options}{'force'}='';
 
     $self->{options}{'verbose'}='';
@@ -224,12 +233,14 @@
     my (%options)=@_;
  
     # don't translate entries composed of one entity
-    if (($string =~ /^&[^;]*;$/) || ($options{'wrap'} && $string =~ /^\s*&[^;]*;\s*$/)){
+    if ( (($string =~ /^&[^;]*;$/) || ($options{'wrap'} && $string =~ /^\s*&[^;]*;\s*$/))
+	 && !($self->{options}{'include-all'}) ){
 	warn sprintf(gettext("po4a::sgml: msgid skipped to help translators (contains only an entity)"), $string)."\n";
 	return $string;
     }
     # don't translate entries composed of tags only
-    if ($string =~ /^(((<[^>]*>)|\s)*)$/) {
+    if ( $string =~ /^(((<[^>]*>)|\s)*)$/
+	 && !($self->{options}{'include-all'}) ) {
 	warn sprintf(gettext("po4a::sgml: msgid skipped to help translators (contains only tags)"), $string)."\n";
 	return $string;
     }