[Po4a-commits] po4a/lib/Locale/Po4a Man.pm,1.45,1.46

Martin Quinson po4a-devel@lists.alioth.debian.org
Mon, 27 Sep 2004 09:00:51 +0000


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

Modified Files:
	Man.pm 
Log Message:
Do not quote the macro arguments when it would result in a breakage (because they are already quoted, with the need to display the quotes) [nekral]

Index: Man.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Man.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- Man.pm	27 Sep 2004 08:19:28 -0000	1.45
+++ Man.pm	27 Sep 2004 09:00:49 -0000	1.46
@@ -266,9 +266,18 @@
 sub pushmacro {
     my $self=shift;
     if (scalar @_) { 
+	# Do quote the arguments containing spaces, as it should.
+	
+	#  but do not do so if they already contain quotes and escaped spaces
+	# For example, cdrdao(1) uses:
+	# .IP CATALOG\ "ddddddddddddd" (Here, the quote have to be displayed)
+	# 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/ / ? "\"$_\"" 
+					            : ( length($_) && m/([^\\] |^ )/ ? "\"$_\"" 
 							                   : "$_"||'""'
 						      )
 				         ) : ''