line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- perl -*- |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# HTML::EP - A Perl based HTML extension. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright (C) 1998 Jochen Wiedmann |
7
|
|
|
|
|
|
|
# Am Eisteich 9 |
8
|
|
|
|
|
|
|
# 72555 Metzingen |
9
|
|
|
|
|
|
|
# Germany |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Email: joe@ispsoft.de |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# Portions Copyright (C) 1999 OnTV Pittsburgh, L.P. |
15
|
|
|
|
|
|
|
# 123 University St. |
16
|
|
|
|
|
|
|
# Pittsburgh, PA 15213 |
17
|
|
|
|
|
|
|
# USA |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# Phone: 1 412 681 5230 |
20
|
|
|
|
|
|
|
# Developer: Jason McMullan |
21
|
|
|
|
|
|
|
# Developer: Erin Glendenning |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
# All rights reserved. |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# You may distribute this module under the terms of either |
27
|
|
|
|
|
|
|
# the GNU General Public License or the Artistic License, as |
28
|
|
|
|
|
|
|
# specified in the Perl README file. |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
############################################################################ |
31
|
|
|
|
|
|
|
|
32
|
8
|
|
|
8
|
|
9170
|
use HTML::Parser (); |
|
8
|
|
|
|
|
274745
|
|
|
8
|
|
|
|
|
7400
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
package HTML::EP::Parser; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$HTML::EP::Parser::VERSION = '0.01'; |
38
|
|
|
|
|
|
|
@HTML::EP::Parser::ISA = qw(HTML::Parser); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
87
|
|
|
87
|
1
|
374
|
my $self = shift->SUPER::new(@_); |
43
|
87
|
|
|
|
|
4723
|
$self->{'_ep_tokens'} = []; |
44
|
87
|
|
|
|
|
162
|
$self->{'_ep_text'} = undef; |
45
|
87
|
|
|
|
|
211
|
$self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub declaration { |
49
|
1
|
|
|
1
|
1
|
11
|
my($self, $decl) = @_; |
50
|
1
|
|
|
|
|
7
|
$self->text(""); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub start { |
54
|
268
|
|
|
268
|
1
|
520
|
my($self, $tag, $attr, $attrseq, $origtext) = @_; |
55
|
268
|
100
|
|
|
|
1021
|
return $self->text($origtext) unless $tag =~ /^ep-/; |
56
|
229
|
|
|
|
|
274
|
push(@{$self->{'_ep_tokens'}}, |
|
229
|
|
|
|
|
1093
|
|
57
|
|
|
|
|
|
|
{'type' => 'S', |
58
|
|
|
|
|
|
|
'tag' => $tag, |
59
|
|
|
|
|
|
|
'attr' => $attr, |
60
|
|
|
|
|
|
|
'attrseq' => $attrseq, |
61
|
|
|
|
|
|
|
'origtext' => $origtext}); |
62
|
229
|
|
|
|
|
1546
|
$self->{'_ep_text'} = undef; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub end { |
66
|
126
|
|
|
126
|
1
|
234
|
my($self, $tag, $origtext) = @_; |
67
|
126
|
100
|
|
|
|
445
|
return $self->text($origtext) unless $tag =~ /^ep-/; |
68
|
88
|
|
|
|
|
104
|
push(@{$self->{'_ep_tokens'}}, |
|
88
|
|
|
|
|
360
|
|
69
|
|
|
|
|
|
|
{'type' => 'E', 'tag' => $tag, 'origtext' => $origtext}); |
70
|
88
|
|
|
|
|
443
|
$self->{'_ep_text'} = undef; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub text { |
74
|
425
|
|
|
425
|
1
|
805
|
my($self, $text) = @_; |
75
|
425
|
100
|
|
|
|
852
|
if (my $t = $self->{'_ep_text'}) { |
76
|
159
|
|
|
|
|
1063
|
$t->{'text'} .= $text; |
77
|
|
|
|
|
|
|
} else { |
78
|
266
|
|
|
|
|
293
|
push(@{$self->{'_ep_tokens'}}, |
|
266
|
|
|
|
|
2232
|
|
79
|
|
|
|
|
|
|
($self->{'_ep_text'} = {'type' => 'T', 'text' => $text})); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub comment { |
84
|
2
|
|
|
2
|
1
|
15
|
my($self, $comment) = @_; |
85
|
2
|
|
|
|
|
8
|
$self->text(""); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
package HTML::EP::Tokens; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub new { |
92
|
87
|
|
|
87
|
|
122
|
my $proto = shift; |
93
|
87
|
50
|
|
|
|
306
|
my $self = { (@_ == 1) ? %{shift()} : @_ }; |
|
0
|
|
|
|
|
0
|
|
94
|
87
|
50
|
|
|
|
233
|
die "Missing token array" unless exists $self->{'tokens'}; |
95
|
87
|
50
|
|
|
|
309
|
$self->{'first'} = 0 unless exists $self->{'first'}; |
96
|
87
|
50
|
|
|
|
193
|
$self->{'last'} = @{$self->{'tokens'}} unless exists $self->{'last'}; |
|
87
|
|
|
|
|
208
|
|
97
|
87
|
|
33
|
|
|
572
|
bless($self, (ref($proto) || $proto)); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub Clone { |
101
|
88
|
|
|
88
|
|
152
|
my($proto, $first, $last) = @_; |
102
|
88
|
|
|
|
|
350
|
my $self = {%$proto}; |
103
|
88
|
50
|
|
|
|
254
|
$self->{'first'} = $first if defined $first; |
104
|
88
|
50
|
|
|
|
194
|
$self->{'last'} = $last if defined $first; |
105
|
88
|
|
|
|
|
457
|
bless($self, ref($proto)); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub First { |
109
|
329
|
|
|
329
|
|
381
|
my $self = shift; |
110
|
329
|
100
|
|
|
|
587
|
if (@_) { $self->{'first'} = shift() } else { $self->{'first'} } |
|
75
|
|
|
|
|
164
|
|
|
254
|
|
|
|
|
833
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
sub Last { |
113
|
150
|
|
|
150
|
|
162
|
my $self = shift; |
114
|
150
|
100
|
|
|
|
229
|
if (@_) { $self->{'last'} = shift() } else { $self->{'last'} } |
|
75
|
|
|
|
|
149
|
|
|
75
|
|
|
|
|
185
|
|
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
sub Token { |
117
|
1030
|
|
|
1030
|
|
1400
|
my $self = shift(); |
118
|
1030
|
|
|
|
|
1416
|
my $first = $self->{'first'}; |
119
|
1030
|
100
|
|
|
|
2861
|
return undef if $first >= $self->{'last'}; |
120
|
809
|
|
|
|
|
1372
|
$self->{'first'} = $first+1; |
121
|
809
|
|
|
|
|
3318
|
$self->{'tokens'}->[$first]; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
sub Replace { |
124
|
3
|
|
|
3
|
|
4
|
my($self, $index, $token) = @_; |
125
|
3
|
|
|
|
|
8
|
$self->{'tokens'}->[$index] = $token; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |