line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Subtext; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7044
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
898
|
use URI::Escape; |
|
1
|
|
|
|
|
1599
|
|
|
1
|
|
|
|
|
61
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
477
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require HTML::Filter; |
8
|
|
|
|
|
|
|
@ISA=qw(HTML::Filter); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = '1.03'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
2
|
|
|
2
|
1
|
137
|
my $class = shift; |
14
|
2
|
|
|
|
|
14
|
my $self = $class->SUPER::new(); |
15
|
2
|
|
|
|
|
110
|
while (@_) { |
16
|
4
|
|
|
|
|
6
|
my $key = shift; |
17
|
4
|
|
|
|
|
4
|
my $val = shift; |
18
|
4
|
|
|
|
|
15
|
$self->{$key} = $val; |
19
|
|
|
|
|
|
|
} |
20
|
2
|
|
|
|
|
5
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub output { |
24
|
28
|
|
|
28
|
0
|
59
|
my $self = shift; |
25
|
28
|
|
|
|
|
28
|
my $output = $self->{'OUTPUT'}; |
26
|
28
|
50
|
|
|
|
35
|
if ($output) { |
27
|
28
|
|
|
|
|
32
|
my $type = ref($output); |
28
|
28
|
100
|
|
|
|
42
|
if ($type eq 'ARRAY') { |
|
|
50
|
|
|
|
|
|
29
|
14
|
|
|
|
|
13
|
push(@{$output}, $_[0]); |
|
14
|
|
|
|
|
78
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
elsif ($type eq 'SCALAR') { |
32
|
14
|
|
|
|
|
88
|
$$output .= $_[0]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
0
|
|
|
|
|
0
|
print $output $_[0]; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
0
|
|
|
|
|
0
|
$self->SUPER::output(@_); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub start { |
44
|
12
|
|
|
12
|
1
|
56
|
my $self = shift; |
45
|
12
|
|
|
|
|
14
|
my $tag = $_[0]; |
46
|
12
|
100
|
66
|
|
|
46
|
if ($tag eq 'a' && $_[1]{'href'} =~ /^subtext:(.*)/) { |
47
|
|
|
|
|
|
|
($self->{subtext} = $self->{'CONTEXT'}{uri_unescape($1)}) |
48
|
4
|
50
|
|
|
|
19
|
|| do { warn "WARNING: HTML::Subtext -- no context for " . $_[3] . "\n"; |
|
0
|
|
|
|
|
0
|
|
49
|
0
|
|
|
|
|
0
|
$self->SUPER::start(@_); } |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
8
|
|
|
|
|
23
|
$self->SUPER::start(@_); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub text { |
57
|
12
|
|
|
12
|
1
|
53
|
my $self = shift; |
58
|
12
|
100
|
|
|
|
18
|
if ($self->{subtext}) { |
59
|
4
|
|
|
|
|
9
|
$self->output($self->{subtext}); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else { |
62
|
8
|
|
|
|
|
22
|
$self->SUPER::text(@_); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub end { |
67
|
12
|
|
|
12
|
1
|
11
|
my $self = shift; |
68
|
12
|
|
|
|
|
14
|
my $tag = $_[0]; |
69
|
12
|
100
|
66
|
|
|
31
|
if ($self->{subtext} && $tag eq 'a') { |
70
|
4
|
|
|
|
|
16
|
$self->{subtext} = 0; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
else { |
73
|
8
|
|
|
|
|
20
|
$self->SUPER::end(@_); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
__END__ |