tags 595946 +patch thanks 2010/9/7 Michal Čihař <ni...@debian.org>: > Package: po4a > Version: 0.40.1-1 > Severity: wishlist > File: /usr/share/perl5/Locale/Po4a/Text.pm > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi > > currently po4a parses asciidoc titles properly, however it includes new > line in the po file. I think this should be avoided.
Hi, Here is a patch against SVN trunk; unit tests are updated. Denis
diff --git a/lib/Locale/Po4a/Text.pm b/lib/Locale/Po4a/Text.pm index 8f703c8..9c58d1a 100644 --- a/lib/Locale/Po4a/Text.pm +++ b/lib/Locale/Po4a/Text.pm @@ -273,14 +273,15 @@ sub parse { $wrapped_mode = 0; my $level = $line; $level =~ s/^(.).*$/$1/; + $paragraph =~ s/\n$//s; my $t = $self->translate($paragraph, $self->{ref}, "Title $level", "wrap" => 0); - $self->pushline($t); + $self->pushline($t."\n"); $paragraph=""; $wrapped_mode = 1; - $self->pushline(($level x (length($t)-1))."\n"); + $self->pushline(($level x (length($t)))."\n"); } elsif ($asciidoc and ($line =~ m/^(={1,5})( +)(.*?)( +\1)?$/)) { my $titlelevel1 = $1; diff --git a/t/data-30/Attributes.po b/t/data-30/Attributes.po index 02117ce..47f3485 100644 --- a/t/data-30/Attributes.po +++ b/t/data-30/Attributes.po @@ -18,7 +18,7 @@ msgstr "" #. type: Title = #: ../data-30/Attributes.asciidoc:2 #, no-wrap -msgid "Test Attributes\n" +msgid "Test Attributes" msgstr "" #. type: Attribute :Author: diff --git a/t/data-30/BlockId.po b/t/data-30/BlockId.po index 0227fc0..9e8d3de 100644 --- a/t/data-30/BlockId.po +++ b/t/data-30/BlockId.po @@ -18,7 +18,7 @@ msgstr "" #. type: Title = #: ../data-30/BlockId.asciidoc:2 #, no-wrap -msgid "Test BlockId Element\n" +msgid "Test BlockId Element" msgstr "" #. type: Plain text diff --git a/t/data-30/BlockTitles.po b/t/data-30/BlockTitles.po index 3109817..927b763 100644 --- a/t/data-30/BlockTitles.po +++ b/t/data-30/BlockTitles.po @@ -18,7 +18,7 @@ msgstr "" #. type: Title = #: ../data-30/BlockTitles.asciidoc:2 #, no-wrap -msgid "Test BlockTitles\n" +msgid "Test BlockTitles" msgstr "" #. type: Block title diff --git a/t/data-30/Callouts.po b/t/data-30/Callouts.po index ce9d48a..8f8aa54 100644 --- a/t/data-30/Callouts.po +++ b/t/data-30/Callouts.po @@ -18,7 +18,7 @@ msgstr "" #. type: Title = #: ../data-30/Callouts.asciidoc:2 #, no-wrap -msgid "Test Callouts\n" +msgid "Test Callouts" msgstr "" #. type: Block title diff --git a/t/data-30/DelimitedBlocks.po b/t/data-30/DelimitedBlocks.po index 12be7df..c3bec53 100644 --- a/t/data-30/DelimitedBlocks.po +++ b/t/data-30/DelimitedBlocks.po @@ -18,13 +18,13 @@ msgstr "" #. type: Title = #: ../data-30/DelimitedBlocks.asciidoc:2 #, no-wrap -msgid "Test Delimited Blocks\n" +msgid "Test Delimited Blocks" msgstr "" #. type: Title - #: ../data-30/DelimitedBlocks.asciidoc:5 #, no-wrap -msgid "Predefined Delimited Blocks\n" +msgid "Predefined Delimited Blocks" msgstr "" #. type: Plain text diff --git a/t/data-30/Footnotes.po b/t/data-30/Footnotes.po index 2ae88a9..69b7a50 100644 --- a/t/data-30/Footnotes.po +++ b/t/data-30/Footnotes.po @@ -18,7 +18,7 @@ msgstr "" #. type: Title = #: ../data-30/Footnotes.asciidoc:2 #, no-wrap -msgid "Test Footnotes\n" +msgid "Test Footnotes" msgstr "" #. type: Plain text diff --git a/t/data-30/Lists.po b/t/data-30/Lists.po index 00beaac..0b9b5d0 100644 --- a/t/data-30/Lists.po +++ b/t/data-30/Lists.po @@ -18,13 +18,13 @@ msgstr "" #. type: Title = #: ../data-30/Lists.asciidoc:2 #, no-wrap -msgid "Test Lists\n" +msgid "Test Lists" msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:5 #, no-wrap -msgid "Bulleted and Numbered Lists\n" +msgid "Bulleted and Numbered Lists" msgstr "" #. type: Plain text @@ -97,7 +97,7 @@ msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:38 #, no-wrap -msgid "Vertical Labeled Lists\n" +msgid "Vertical Labeled Lists" msgstr "" #. type: Labeled list @@ -154,7 +154,7 @@ msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:59 #, no-wrap -msgid "Horizontal Labeled Lists\n" +msgid "Horizontal Labeled Lists" msgstr "" #. type: Labeled list @@ -193,7 +193,7 @@ msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:76 #, no-wrap -msgid "Question and Answer Lists\n" +msgid "Question and Answer Lists" msgstr "" #. type: Labeled list @@ -221,7 +221,7 @@ msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:83 #, no-wrap -msgid "Glossary Lists\n" +msgid "Glossary Lists" msgstr "" #. type: Labeled list @@ -244,7 +244,7 @@ msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:91 #, no-wrap -msgid "Bibliography Lists\n" +msgid "Bibliography Lists" msgstr "" #. type: Plain text @@ -274,7 +274,7 @@ msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:102 #, no-wrap -msgid "Bibliography\n" +msgid "Bibliography" msgstr "" #. type: Plain text @@ -287,7 +287,7 @@ msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:110 #, no-wrap -msgid "List Item Continuation\n" +msgid "List Item Continuation" msgstr "" #. type: Plain text @@ -348,7 +348,7 @@ msgstr "" #. type: Title - #: ../data-30/Lists.asciidoc:138 #, no-wrap -msgid "List Block\n" +msgid "List Block" msgstr "" #. type: Block title diff --git a/t/data-30/Paragraphs.po b/t/data-30/Paragraphs.po index c639332..95f4810 100644 --- a/t/data-30/Paragraphs.po +++ b/t/data-30/Paragraphs.po @@ -18,13 +18,13 @@ msgstr "" #. type: Title = #: ../data-30/Paragraphs.asciidoc:2 #, no-wrap -msgid "Test Paragraphs\n" +msgid "Test Paragraphs" msgstr "" #. type: Title - #: ../data-30/Paragraphs.asciidoc:5 #, no-wrap -msgid "Default Paragraph\n" +msgid "Default Paragraph" msgstr "" #. type: Plain text @@ -41,7 +41,7 @@ msgstr "" #. type: Title - #: ../data-30/Paragraphs.asciidoc:16 #, no-wrap -msgid "Literal Paragraph\n" +msgid "Literal Paragraph" msgstr "" #. type: Plain text @@ -79,7 +79,7 @@ msgstr "" #. type: Title - #: ../data-30/Paragraphs.asciidoc:42 #, no-wrap -msgid "Admonition Paragraphs\n" +msgid "Admonition Paragraphs" msgstr "" #. type: Plain text diff --git a/t/data-30/Tables.po b/t/data-30/Tables.po index bfe0fed..bef19f2 100644 --- a/t/data-30/Tables.po +++ b/t/data-30/Tables.po @@ -18,7 +18,7 @@ msgstr "" #. type: Title = #: ../data-30/Tables.asciidoc:2 #, no-wrap -msgid "Test Tables\n" +msgid "Test Tables" msgstr "" # FIXME diff --git a/t/data-30/Titles.po b/t/data-30/Titles.po index ebfa13c..670786b 100644 --- a/t/data-30/Titles.po +++ b/t/data-30/Titles.po @@ -18,31 +18,31 @@ msgstr "" #. type: Title = #: ../data-30/Titles.asciidoc:2 #, no-wrap -msgid "Title0\n" +msgid "Title0" msgstr "" #. type: Title - #: ../data-30/Titles.asciidoc:5 #, no-wrap -msgid "Title1\n" +msgid "Title1" msgstr "" #. type: Title ~ #: ../data-30/Titles.asciidoc:8 #, no-wrap -msgid "Title level 2\n" +msgid "Title level 2" msgstr "" #. type: Title ^ #: ../data-30/Titles.asciidoc:11 #, no-wrap -msgid "Title level 3\n" +msgid "Title level 3" msgstr "" #. type: Title + #: ../data-30/Titles.asciidoc:14 #, no-wrap -msgid "Title level 4\n" +msgid "Title level 4" msgstr "" #. type: Title =