line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::Maketext::Extract::Plugin::Haml; |
2
|
|
|
|
|
|
|
$Locale::Maketext::Extract::Plugin::Haml::VERSION = '1.00'; |
3
|
4
|
|
|
4
|
|
25
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
155
|
|
4
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
159
|
|
5
|
4
|
|
|
4
|
|
70
|
use base qw(Locale::Maketext::Extract::Plugin::Base); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1242
|
|
6
|
4
|
|
|
4
|
|
148680
|
use Text::Haml; |
|
4
|
|
|
|
|
166000
|
|
|
4
|
|
|
|
|
228
|
|
7
|
4
|
|
|
4
|
|
986
|
use Locale::Maketext::Extract::Plugin::Perl; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
901
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: HAML format parser |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub file_types { |
13
|
18
|
|
|
18
|
1
|
57
|
return qw( haml ); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub extract { |
17
|
10
|
|
|
10
|
1
|
14
|
my $self = shift; |
18
|
10
|
|
|
|
|
18
|
my $content = shift; |
19
|
|
|
|
|
|
|
|
20
|
10
|
|
|
|
|
63
|
my $haml = Text::Haml->new; |
21
|
10
|
|
|
|
|
1047
|
$haml->parse($content); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Checking for expr and text allows us to recognise |
24
|
|
|
|
|
|
|
# the types of HTML entries we are interested in. |
25
|
8
|
100
|
100
|
|
|
26
|
my @texts = map { $_->{text} } |
|
28
|
|
|
|
|
175
|
|
26
|
10
|
|
|
|
|
92
|
grep { $_->{text} and ( $_->{expr} or $_->{type} eq 'block') } |
27
|
10
|
|
|
|
|
4711
|
@{ $haml->tape }; |
28
|
|
|
|
|
|
|
|
29
|
10
|
|
|
|
|
78
|
my $perl = Locale::Maketext::Extract::Plugin::Perl->new; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Calling extract on our strings will cause |
32
|
|
|
|
|
|
|
# EPPerl to store our entries internally. |
33
|
10
|
|
|
|
|
20
|
map { $perl->extract($_) } @texts; |
|
8
|
|
|
|
|
30
|
|
34
|
|
|
|
|
|
|
|
35
|
10
|
|
|
|
|
18
|
map { $self->add_entry( @{$_} ) } @{ $perl->entries }; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
35
|
|
|
10
|
|
|
|
|
37
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |