line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::EN::Titlecase::HTML; |
2
|
2
|
|
|
2
|
|
7498
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
75
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
263
|
|
4
|
2
|
|
|
2
|
|
1088
|
use parent "Lingua::EN::Titlecase"; |
|
2
|
|
|
|
|
591
|
|
|
2
|
|
|
|
|
13
|
|
5
|
2
|
|
|
2
|
|
3407
|
use HTML::TokeParser; |
|
2
|
|
|
|
|
61172
|
|
|
2
|
|
|
|
|
921
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub lexer : method { |
8
|
280
|
|
|
280
|
1
|
676
|
my $self = shift; |
9
|
280
|
100
|
|
|
|
1761
|
return $self->{_lexer} if $self->{_lexer}; |
10
|
|
|
|
|
|
|
|
11
|
8
|
|
|
|
|
23
|
my $wp = $self->word_punctuation; |
12
|
8
|
|
|
|
|
47
|
my $wordish = $self->wordish_rx; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$self->{_lexer} = sub { |
15
|
368
|
100
|
|
368
|
|
1061
|
unless ( $self->{_raw_html} ) { |
16
|
14
|
|
|
|
|
34
|
my $tmp = $self->{_raw_html} = shift; |
17
|
14
|
|
|
|
|
89
|
$self->{_parser} = HTML::TokeParser->new(\$tmp); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
368
|
100
|
100
|
|
|
5188
|
if ( defined $self->{__text} and length $self->{__text} ) |
|
|
100
|
|
|
|
|
|
21
|
|
|
|
|
|
|
{ |
22
|
176
|
100
|
|
|
|
1999
|
$self->{__text} =~ s/\A($wordish)// and return [ "word", "$1" ]; |
23
|
88
|
50
|
|
|
|
919
|
$self->{__text} =~ s/\A(.)//s and return [ undef, "$1" ]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
elsif ( my $token = $self->{_parser}->get_token() ) |
26
|
|
|
|
|
|
|
{ |
27
|
178
|
100
|
|
|
|
9992
|
return [ undef, $token->[-1] ] unless $token->[0] eq "T"; |
28
|
88
|
|
|
|
|
197
|
$self->{__text} = $token->[1]; |
29
|
88
|
|
|
|
|
326
|
return $self->{_lexer}->(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else |
32
|
|
|
|
|
|
|
{ |
33
|
14
|
|
|
|
|
311
|
$self->{_raw_html} = undef; # reset for next possible pass |
34
|
14
|
|
|
|
|
28
|
$self->{_parser} = undef; |
35
|
14
|
|
|
|
|
125
|
return (); |
36
|
|
|
|
|
|
|
} |
37
|
8
|
|
|
|
|
281
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |