Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sympa
sympa
Commits
3cc715d9
Commit
3cc715d9
authored
Oct 05, 2018
by
IKEDA Soji
Browse files
xgettext.pl: Support [% "..." | loc %] in templates.
parent
518284a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
po/sympa/xgettext.pl
View file @
3cc715d9
...
...
@@ -305,7 +305,7 @@ foreach my $file (@ordered_files) {
);
}
# Template Toolkit
# Template Toolkit
: [%|loc(...)%]...[%END%]
$line
=
1
;
pos
(
$_
)
=
0
;
while
(
...
...
@@ -326,6 +326,41 @@ foreach my $file (@ordered_files) {
&add_expression
(
$expression
);
}
# Template Toolkit: [% "..." | loc(...) %]
$line
=
1
;
pos
$_
=
0
;
while
(
m{
\G .*?
\[ % [-=~+]? \s*
(?: \' ((?:\\|\.|[^'])*) \' | \" ((?:\\|\.|[^"])*) \" ) \s*
\| \s*
($available_tags)
(.*?)
\s* [-=~+]? % \]
}sgx
)
{
my
$str
=
$
1
||
$
2
;
my
$this_tag
=
$
3
;
my
$vars
=
$
4
;
$line
+=
(()
=
(
$&
=~
/\n/g
));
$str
=~
s{\\(.)}{
($1 eq 't') ? "\t" :
($1 eq 'n') ? "\n" :
($1 eq 'r') ? "\r" :
$1
}eg
;
$vars
=~
s/^\s*[(](.*?)[)].*/$1/
or
$vars
=
'';
my
$expression
=
{
'
expression
'
=>
$str
,
'
filename
'
=>
$filename
,
'
line
'
=>
$line
,
'
vars
'
=>
$vars
};
$expression
->
{'
type
'}
=
'
date
'
if
(
$this_tag
eq
'
locdt
');
&add_expression
(
$expression
);
}
# Template Toolkit with ($tag$%|loc%$tag$)...($tag$%END%$tag$) in archives
$line
=
1
;
pos
(
$_
)
=
0
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment