Skip to content

Commit 91937e7

Browse files
committed
Allow Vim language specification for code block beginning
* lib/Locale/Po4a/VimHelp.pm: Added support for an optional Vim language specification (">vim" followed by a line end) for the beginning of code blocks, in addition to the existing ">". * t/fmt/vimhelp/basic.norm:, t/fmt/vimhelp/basic.po, t/fmt/vimhelp/basic.pot, t/fmt/vimhelp/basic.trans, t/fmt/vimhelp/basic.txt: Add a test case.
1 parent 7bad195 commit 91937e7

File tree

6 files changed

+39
-3
lines changed

6 files changed

+39
-3
lines changed

lib/Locale/Po4a/VimHelp.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ sub skip_tags {
141141
sub is_tags {
142142
my $line = shift;
143143

144-
$line =~ / \A \s* [*] [^*]+ [*] (?: \s+ [*] [^*]+ [*] )* (\s+ [>])? \Z /xms or return;
144+
$line =~ / \A \s* [*] [^*]+ [*] (?: \s+ [*] [^*]+ [*] )* (\s+ [>] (vim)?)? \Z /xms or return;
145145
my $codeblock = $1;
146146

147147
return { codeblock => $codeblock };
@@ -174,7 +174,7 @@ sub translate_codeblock_with_start_line {
174174
}
175175

176176
sub is_codeblock_start_line {
177-
return shift =~ / \A [>] \Z /xms;
177+
return shift =~ / \A [>] (vim)? \Z /xms;
178178
}
179179

180180
sub translate_paragraph {
@@ -221,7 +221,7 @@ sub translate_paragraph {
221221
sub parse_paragraph_line {
222222
my $line = shift;
223223

224-
$line =~ / \A (.*?) (\s+ [>])? \Z /xms or die "unreachable";
224+
$line =~ / \A (.*?) (\s+ [>] (vim)?)? \Z /xms or die "unreachable";
225225
my $content = $1;
226226
my $codeblock = $2;
227227

t/fmt/vimhelp/basic.norm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ basic15-90123456789012345678901234567890123456789012345678901234567890123456789
2020

2121
basic17-901234567890123456789012345678901234567890123456789012345678901234567あ
2222
---------1---------2---------3---------4---------5---------6---------7---------
23+
24+
basic18-1 >vim
25+
basic18-2
26+
<

t/fmt/vimhelp/basic.po

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,15 @@ msgid ""
8585
msgstr ""
8686
"BASIC17-901234567890123456789012345678901234567890123456789012345678901234567あ\n"
8787
"---------1---------2---------3---------4---------5---------6---------7---------"
88+
89+
#. type: paragraph
90+
#: basic.txt:24
91+
#, no-wrap
92+
msgid "basic18-1"
93+
msgstr "BASIC18-1"
94+
95+
#. type: codeblock
96+
#: basic.txt:25
97+
#, no-wrap
98+
msgid "basic18-2"
99+
msgstr "BASIC18-2"

t/fmt/vimhelp/basic.pot

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,15 @@ msgid ""
7777
"basic17-901234567890123456789012345678901234567890123456789012345678901234567あ\n"
7878
"---------1---------2---------3---------4---------5---------6---------7---------"
7979
msgstr ""
80+
81+
#. type: paragraph
82+
#: basic.txt:24
83+
#, no-wrap
84+
msgid "basic18-1"
85+
msgstr ""
86+
87+
#. type: codeblock
88+
#: basic.txt:25
89+
#, no-wrap
90+
msgid "basic18-2"
91+
msgstr ""

t/fmt/vimhelp/basic.trans

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ BASIC15-90123456789012345678901234567890123456789012345678901234567890123456789
2020

2121
BASIC17-901234567890123456789012345678901234567890123456789012345678901234567あ
2222
---------1---------2---------3---------4---------5---------6---------7---------
23+
24+
BASIC18-1 >vim
25+
BASIC18-2
26+
<

t/fmt/vimhelp/basic.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ basic15-90123456789012345678901234567890123456789012345678901234567890123456789
2020

2121
basic17-901234567890123456789012345678901234567890123456789012345678901234567あ
2222
---------1---------2---------3---------4---------5---------6---------7---------
23+
24+
basic18-1 >vim
25+
basic18-2
26+
<

0 commit comments

Comments
 (0)