[Po4a-commits] r2684 - /trunk/lib/Locale/Po4a/AsciiDoc.pm
barbier at users.alioth.debian.org
barbier at users.alioth.debian.org
Fri Oct 26 22:19:46 UTC 2012
Author: barbier
Date: Fri Oct 26 22:19:46 2012
New Revision: 2684
URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2684
Log:
AsciiDoc: Rename 'attributeentry' option into 'entry'
Add 'macro' and 'style' options. The whole configuration
can now be performed either inline, in a separate file or
through options.
Definitions are performed in the following order:
1. default definitions
2. loaded from a file by the 'definitions' command-line option
3. other command-line options (entry, macro, style)
4. inline definitions
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=2684&op=diff
==============================================================================
--- trunk/lib/Locale/Po4a/AsciiDoc.pm (original)
+++ trunk/lib/Locale/Po4a/AsciiDoc.pm Fri Oct 26 22:19:46 2012
@@ -37,11 +37,6 @@
=over
-=item B<attributeentry>
-
-Space-separated list of attribute entries you want to translate. By default,
-no attribute entries are translatable.
-
=item B<definitions>
The name of a file containing definitions for po4a, as defined in the
@@ -49,6 +44,24 @@
You can use this option if it is not possible to put the definitions in
the document being translated.
+In a definitions file, lines must not start by two slashes, but directly
+by B<po4a:>.
+
+=item B<entry>
+
+Space-separated list of attribute entries you want to translate. By default,
+no attribute entries are translatable.
+
+=item B<macro>
+
+Space-separated list of macro definitions.
+
+=item B<style>
+
+Space-separated list of style definitions.
+
+=back
+
=head1 INLINE CUSTOMIZATION
The AsciiDoc module can be customized with lines starting by B<//po4a:>.
@@ -110,7 +123,9 @@
$self->{options}{'nobullets'} = 1;
$self->{options}{'debug'}='';
$self->{options}{'verbose'} = 1;
- $self->{options}{'attributeentry'}='';
+ $self->{options}{'entry'}='';
+ $self->{options}{'macro'}='';
+ $self->{options}{'style'}='';
$self->{options}{'definitions'}='';
foreach my $opt (keys %options) {
@@ -129,7 +144,7 @@
$self->{translate} = {
macro => {},
style => {},
- attributeentry => {}
+ entry => {}
};
$self->register_attributelist('[verse,2,3,attribution,citetitle]');
@@ -142,9 +157,17 @@
if ($self->{options}{'definitions'}) {
$self->parse_definition_file($self->{options}{'definitions'})
}
- $self->{options}{attributeentry} =~ /^\s*(.*?)\s*$/s;
- foreach my $attr (split(/\s+/s,$1)) {
- $self->{translate}->{attributeentry}->{$attr} = 1;
+ $self->{options}{entry} =~ s/^\s*//;
+ foreach my $attr (split(/\s+/, $self->{options}{entry})) {
+ $self->{translate}->{entry}->{$attr} = 1;
+ }
+ $self->{options}{macro} =~ s/^\s*//;
+ foreach my $attr (split(/\s+/, $self->{options}{macro})) {
+ $self->register_macro($attr);
+ }
+ $self->{options}{style} =~ s/^\s*//;
+ foreach my $attr (split(/\s+/, $self->{options}{style})) {
+ $self->register_attributelist($attr);
}
}
@@ -205,7 +228,7 @@
} elsif ($command =~ m/^po4a: style\s*(\[.*\])\s*$/) {
$self->register_attributelist($1);
} elsif ($command =~ m/^po4a: entry\s+(.+?)\s*$/) {
- $self->{translate}->{attributeentry}->{$1} = 1;
+ $self->{translate}->{entry}->{$1} = 1;
}
}
@@ -492,7 +515,7 @@
$wrapped_mode = 1;
undef $self->{bullet};
undef $self->{indent};
- if (defined($self->{translate}->{attributeentry}->{$attrname})) {
+ if (defined($self->{translate}->{entry}->{$attrname})) {
my $t = $self->translate($attrvalue,
$self->{ref},
"Attribute :$attrname:",
More information about the Po4a-commits
mailing list