[Po4a-commits] "po4a/lib/Locale/Po4a Man.pm,1.138,1.139"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Mon Apr 17 13:13:52 UTC 2006


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

Modified Files:
	Man.pm 
Log Message:
Add support for \# groff comments.


Index: Man.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Man.pm,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- Man.pm	17 Apr 2006 12:24:09 -0000	1.138
+++ Man.pm	17 Apr 2006 13:13:50 -0000	1.139
@@ -516,8 +516,8 @@
     $line =~ s/\\\././g;
 
     chomp $line;
-    if ($line =~ m/^(.*?)(?:(?<!\\)\\"(.*))$/) {
-        my ($l, $c) = ($1, $2);
+    if ($line =~ m/^(.*?)(?:(?<!\\)\\(["#])(.*))$/) {
+        my ($l, $t, $c) = ($1, $2, $3);
         $line = $l;
         # Check for comments indicating that the file was generated.
         if ($c =~ /Pod::Man/) {
@@ -562,6 +562,10 @@
                 # (empty lines are a little bit different)
                 goto NEW_LINE;
             }
+            if ($line =~ m/^\s*$/ and $t eq "#") {
+                # Groff comments
+                goto NEW_LINE;
+            }
         } else {
             push @comments, $c;
         }
@@ -1054,7 +1058,7 @@
 
 	if ($line =~ /^[.']/) {
 	    die wrap_mod("po4a::man", dgettext("po4a", "Unparsable line: %s"), $line)
-		unless ($line =~ /^([.']+\\*?)(\\\")(.*)/ ||
+		unless ($line =~ /^([.']+\\*?)(\\["#])(.*)/ ||
 			$line =~ /^([.'])(\S*)(.*)/);
 	    my $arg1=$1;
 	    $arg1 .= $2;
@@ -1087,12 +1091,13 @@
 
 	    # Special case: Don't change these lines
 	    #  .\"  => comments
+	    #  .\#  => comments
 	    #  ."   => comments
 	    #  .    => empty point on the line
 	    #  .tr abcd...
 	    #       => substitution like Perl's tr/ac/bd/ on output.
-	    if ($macro eq '\"' || $macro eq '' || $macro eq 'tr' ||
-                $macro eq '"') {
+	    if ($macro eq '\\"' || $macro eq '' || $macro eq 'tr' ||
+	        $macro eq '"'   || $macro eq '\\#') {
 		$self->pushline($line."\n");
 		goto LINE;
 	    }
@@ -1142,7 +1147,10 @@
 		# input line is ignored.
 		$self->pushline($line."\n");
 		goto LINE;
-            } else {
+	    } elsif ($line =~ /^\\#/) {
+		# Special groff comment. Do not keep the new line
+		goto LINE;
+	    } else {
 		# Not a macro
 		# * first, try to handle some "output line continuation" (\c)
 		$paragraph =~ s/\\c *(($FONT_RE)?)\n?$/$1/s;




More information about the Po4a-commits mailing list