| 1 | package Serge::Engine::Plugin::parse_wxl; | ||||||||||
| 2 | 1 | ▶ | use parent Serge::Engine::Plugin::Base::Parser; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Serge::Util qw(xml_escape_strref xml_unescape_strref); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub name { | ||||||||||
| 9 | 0 | ▶ | return 'WiX Installer .WXL parser plugin'; | ||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 10 | } | ||||||||||
| 11 | |||||||||||
| 12 | sub parse { | ||||||||||
| 13 | 0 | ▶ | my ($self, $textref, $callbackref, $lang) = @_; | ||||||||
|
Subroutine
parse: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | die 'callbackref not specified' unless $callbackref; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | |||||||||||
| 17 | # Finding translatable strings in file | ||||||||||
| 18 | |||||||||||
| 19 | # Format is: | ||||||||||
| 20 | # <String Id="...hint...">...string...</String> | ||||||||||
| 21 | |||||||||||
| 22 | 0 | my $translated_text = $$textref; | |||||||||
| 23 | |||||||||||
| 24 | 0 | $translated_text =~ s|(<string\s+id=")(.*?)(".*?>)(.*?)(</string>)|$1.$2.$3.$self->parse_callback($callbackref, $4, undef, $2, undef, $lang).$5|sgie; | |||||||||
| 25 | |||||||||||
| 26 | 0 | return $translated_text; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | sub parse_callback { | ||||||||||
| 30 | 0 | ▶ | my ($self, $callbackref, $string, $context, $hint, $flagsref, $lang) = @_; | ||||||||
|
Subroutine
parse_callback: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 31 | |||||||||||
| 32 | 0 | xml_unescape_strref(\$string); | |||||||||
| 33 | |||||||||||
| 34 | 0 | my $translated_string = &$callbackref($string, $context, $hint, $flagsref, $lang); | |||||||||
| 35 | |||||||||||
| 36 | 0 | xml_escape_strref(\$translated_string); | |||||||||
| 37 | |||||||||||
| 38 | 0 | return $translated_string; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 1 | 1; | |||||||||