Skip to content

Commit 4c55c72

Browse files
jnavilamquinson
authored andcommitted
asciidoc: process xlabel of id
This partly fixes #401 but not completely. The problem is that po format does not support inline markup, so we cannot hide formatting marks away from translators. We could use a different format for the translation (for instance xml), but this would require a lot of changes in AsciiDoc.pm. Signed-off-by: Jean-Noël Avila <[email protected]>
1 parent 2766a76 commit 4c55c72

File tree

6 files changed

+27
-5
lines changed

6 files changed

+27
-5
lines changed

lib/Locale/Po4a/AsciiDoc.pm

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,19 @@ sub parse {
687687
{
688688
# Found BlockId
689689
do_paragraph( $self, $paragraph, $wrapped_mode );
690-
$paragraph = "";
690+
my $block_id = $1;
691+
$paragraph = "";
691692
$wrapped_mode = 1;
692-
$self->pushline( $line . "\n" );
693+
if ($block_id =~ m/^([^,]+),(.+)$/) {
694+
# Found BlockId with a xlabel
695+
my $xlabel = $2;
696+
$block_id = $1;
697+
$self->pushline( "[[$block_id," );
698+
do_paragraph( $self, $xlabel, 0);
699+
$self->pushline( "]]\n" );
700+
} else {
701+
$self->pushline( $line . "\n" );
702+
}
693703
undef $self->{bullet};
694704
undef $self->{indent};
695705
} elsif ( not defined $self->{verbatim}

t/fmt/asciidoc/BlockId.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Test BlockId Element
55
Some paragraph text. Some paragraph text. Some paragraph text.
66
Some paragraph text. Some paragraph text. Some paragraph text.
77

8-
8+
[[ipsum-quia,Second Paragraph]]
99
Reference to <<lorem-ipsum, Lorem Ipsum>>.

t/fmt/asciidoc/BlockId.norm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Test BlockId Element
44
[[lorem-ipsum]]
55
Some paragraph text. Some paragraph text. Some paragraph text. Some paragraph text. Some paragraph text. Some paragraph text.
66

7-
7+
[[ipsum-quia,Second Paragraph]]
88
Reference to <<lorem-ipsum, Lorem Ipsum>>.

t/fmt/asciidoc/BlockId.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ msgstr ""
3131
"SOME PARAGRAPH TEXT. SOME PARAGRAPH TEXT. SOME PARAGRAPH TEXT. SOME "
3232
"PARAGRAPH TEXT. SOME PARAGRAPH TEXT. SOME PARAGRAPH TEXT."
3333

34+
#. type: Plain text
35+
#: BlockId.adoc:8
36+
#, no-wrap
37+
msgid "Second Paragraph"
38+
msgstr "SECOND PARAGRAPH"
39+
3440
#. type: Plain text
3541
#: BlockId.adoc:9
3642
msgid "Reference to <<lorem-ipsum, Lorem Ipsum>>."

t/fmt/asciidoc/BlockId.pot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ msgid ""
2929
"paragraph text. Some paragraph text. Some paragraph text."
3030
msgstr ""
3131

32+
#. type: Plain text
33+
#: BlockId.adoc:8
34+
#, no-wrap
35+
msgid "Second Paragraph"
36+
msgstr ""
37+
3238
#. type: Plain text
3339
#: BlockId.adoc:9
3440
msgid "Reference to <<lorem-ipsum, Lorem Ipsum>>."

t/fmt/asciidoc/BlockId.trans

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ TEST BLOCKID ELEMENT
44
[[lorem-ipsum]]
55
SOME PARAGRAPH TEXT. SOME PARAGRAPH TEXT. SOME PARAGRAPH TEXT. SOME PARAGRAPH TEXT. SOME PARAGRAPH TEXT. SOME PARAGRAPH TEXT.
66

7-
7+
[[ipsum-quia,SECOND PARAGRAPH]]
88
REFERENCE TO <<lorem-ipsum, LOREM IPSUM>>.

0 commit comments

Comments
 (0)