[Po4a-commits] po4a/lib/Locale/Po4a Man.pm,1.70,1.71

Nicolas FRAN??OIS po4a-devel@lists.alioth.debian.org
Sun, 28 Nov 2004 14:16:07 +0000


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

Modified Files:
	Man.pm 
Log Message:
Fix another quote issue:
Convert " to \(dq (in the output document) if a double quote is used in a
quoted argument.


Index: Man.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Man.pm,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- Man.pm	28 Nov 2004 14:03:47 -0000	1.70
+++ Man.pm	28 Nov 2004 14:16:05 -0000	1.71
@@ -363,14 +363,22 @@
 	# Adding extra quotes as in:
 	# .IP "CATALOG\ "ddddddddddddd""
 	# results in two args: 'CATALOG\ ' and 'ddddddddddddd""'
-  
-	$self->pushline(join(" ",map { defined $_ ? 
-					 ($_ eq '0' ? "0" 
-					            : ( length($_) && m/([^\\] |^ )/ ? "\"$_\"" 
-							                   : "$_"||'""'
-						      )
-				         ) : ''
-				      } @_)."\n");
+	$self->pushline(join(" ",map {
+		# Replace double quotes by \(dq (double quotes could be
+		# taken as an argument delimiter).
+		# Only quotes not preceded by \ are taken into account
+		# (\" introduces a comment).
+		s/(?<!\\)"/\\\(dq/g if (defined $_);
+
+		defined $_ ? (
+			length($_)?
+			    (m/([^\\] |^ )/ ? "\"$_\"" : "$_")
+			    # Quote arguments that contain a space.
+			    # (not needd for non breaknig spaces, i.e.
+			    # spaces preceded by '\')
+			    :'""' # empty argument
+		) : '' # no argument
+	    } @_)."\n");
     } else {
 	$self->pushline("\n");
     }