Author: ai0867
Date: Mon Nov 14 05:16:01 2011
New Revision: 51967

URL: http://svn.gna.org/viewcvs/wesnoth?rev=51967&view=rev
Log:
Make #po: comments appear on their own lines

Modified:
    trunk/utils/wmlxgettext

Modified: trunk/utils/wmlxgettext
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/wmlxgettext?rev=51967&r1=51966&r2=51967&view=diff
==============================================================================
--- trunk/utils/wmlxgettext (original)
+++ trunk/utils/wmlxgettext Mon Nov 14 05:16:01 2011
@@ -39,7 +39,7 @@
 foreach my $file (@ARGV) {
   open (FILE, "<$file") or die "cannot read from $file";
   my $readingattack = 0;
-  my @nodeinfostack = (["top", [], []]); # dummy top node
+  my @nodeinfostack = (["top", [], [], []]); # dummy top node
   my @domainstack = ($initialdomain);
   my $valid_wml = 1;
  LINE: while (<FILE>) {
@@ -58,7 +58,7 @@
     }
 
     if (m/\#\s*po:\s+(.+)/) {
-      push @{$nodeinfostack[-1][2]}, $1;
+      push @{$nodeinfostack[-1][3]}, $1;
     }
 
     # skip other # lines as comments
@@ -151,7 +151,7 @@
           $valid_wml = 0;
           last;
         }
-        my ($openname, $messages, $metadata) = @{pop @nodeinfostack};
+        my ($openname, $messages, $metadata, $comments) = @{pop 
@nodeinfostack};
         if ($nodename ne $openname) {
           warn "expected closed node \'$openname\' ".
                "got \'$nodename\' at $file:$.";
@@ -165,12 +165,12 @@
         #print STDERR "$ind<<< $.: $nodename\n";
         #print STDERR "==> $file:$.: $nodename: @{$metadata}\n" if 
@{$messages};
         for my $msg (@{$messages}) {
-          push @{$nodeinfo{$msg}}, [$nodename, $metadata];
+          push @{$nodeinfo{$msg}}, [$nodename, $metadata, $comments];
         }
       } else { # opening node
         #print STDERR "$ind>>> $.: $nodename\n";
         $nodename =~ s/\+//;
-        push @nodeinfostack, [$nodename, [], []];
+        push @nodeinfostack, [$nodename, [], [], []];
       }
     }
     # do not add anything here, beware of the next's before the loop
@@ -234,7 +234,7 @@
     if (defined $nodeinfo{$key}) {
       my %added;
       for my $info (@{$nodeinfo{$key}}) {
-        my ($name, $data) = @{$info};
+        my ($name, $data, $comments) = @{$info};
         my $desc = join(", ", @{$data});
         my $nodestr = $desc ? "[$name]: $desc" : "[$name]";
         # Add only unique node info strings.
@@ -242,6 +242,9 @@
             $added{$nodestr} = 1;
             printf "#. %s\n", $nodestr;
         }
+        foreach my $comment (@{$comments}) {
+            printf "#. $comment\n";
+        }
       }
     }
     printf "#: %s\n", join(" ", @{$messages{$key}});


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to