[Po4a-commits] r2676 - /trunk/lib/Locale/Po4a/AsciiDoc.pm

barbier at users.alioth.debian.org barbier at users.alioth.debian.org
Fri Oct 26 22:19:18 UTC 2012


Author: barbier
Date: Fri Oct 26 22:19:17 2012
New Revision: 2676

URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2676
Log:
AsciiDoc: Do not translate attribute entries by default

Handle continuation lines.

Modified:
    trunk/lib/Locale/Po4a/AsciiDoc.pm

Modified: trunk/lib/Locale/Po4a/AsciiDoc.pm
URL: http://svn.debian.org/wsvn/po4a/trunk/lib/Locale/Po4a/AsciiDoc.pm?rev=2676&op=diff
==============================================================================
--- trunk/lib/Locale/Po4a/AsciiDoc.pm (original)
+++ trunk/lib/Locale/Po4a/AsciiDoc.pm Fri Oct 26 22:19:17 2012
@@ -63,6 +63,7 @@
     $self->{options}{'nobullets'} = 1;
     $self->{options}{'debug'}='';
     $self->{options}{'verbose'} = 1;
+    $self->{options}{'attributeentry'}='';
 
     foreach my $opt (keys %options) {
         die wrap_mod("po4a::asciidoc",
@@ -75,6 +76,11 @@
         foreach ($options{'debug'}) {
             $debug{$_} = 1;
         }
+    }
+
+    $self->{options}{attributeentry} =~ /^\s*(.*?)\s*$/s;
+    foreach my $attr (split(/\s+/s,$1)) {
+        $self->{attributeentry}->{$attr} = 1;
     }
 
     if (defined $options{'nobullets'}) {
@@ -379,18 +385,28 @@
             my $attrname = $1;
             my $attrsep = $2;
             my $attrvalue = $3;
+            while ($attrvalue =~ s/ \+$//s) {
+                ($line,$ref)=$self->shiftline();
+                $ref =~ m/^(.*):[0-9]+$/;
+                $line =~ s/^\s+//;
+                $attrvalue .= $line;
+            }
             # Found a Attribute entry
             do_paragraph($self,$paragraph,$wrapped_mode);
             $paragraph="";
             $wrapped_mode = 1;
             undef $self->{bullet};
             undef $self->{indent};
-            my $t = $self->translate($attrvalue,
+            if (defined($self->{attributeentry}->{$attrname})) {
+                my $t = $self->translate($attrvalue,
                                      $self->{ref},
                                      "Attribute :$attrname:",
                                      "comment" => join("\n", @comments),
                                      "wrap" => 0);
-            $self->pushline(":$attrname$attrsep$t\n");
+                $self->pushline(":$attrname$attrsep$t\n");
+            } else {
+                $self->pushline(":$attrname$attrsep$attrvalue\n");
+            }
             @comments=();
         } elsif (not defined $self->{verbatim} and
                  ($line !~ m/^\.\./) and ($line =~ m/^\.(\S.*)$/)) {




More information about the Po4a-commits mailing list