line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::TableContent::Element; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
8190
|
use Moo; |
|
20
|
|
|
|
|
44
|
|
|
20
|
|
|
|
|
88
|
|
4
|
20
|
|
|
20
|
|
5281
|
use HTML::TableContent::Table; |
|
20
|
|
|
|
|
48
|
|
|
20
|
|
|
|
|
41170
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.18'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my @ATTRIBUTE = |
9
|
|
|
|
|
|
|
qw/class id style colspan rowspan onclick onchange type onkeyup placeholder scope selected value |
10
|
|
|
|
|
|
|
autocomplete for onFocus onBlur href role width height data_toggle data_placement title/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
around BUILDARGS => sub { |
13
|
|
|
|
|
|
|
my ( $orig, $class, $args ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $build = (); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
if ( my $links = delete $args->{links} ) { |
18
|
|
|
|
|
|
|
if ( ref $links eq 'ARRAY' ) { |
19
|
|
|
|
|
|
|
$build->{links} = $links; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
if ( my $concat = delete $args->{truncate} ) { |
24
|
|
|
|
|
|
|
$build->{truncate} = $concat; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$build->{attributes} = $args; |
28
|
|
|
|
|
|
|
$build->{attribute_list} = \@ATTRIBUTE; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
for my $field ( @ATTRIBUTE, 'html_tag', 'tag') { |
31
|
|
|
|
|
|
|
if ( defined $args->{$field} ) { |
32
|
|
|
|
|
|
|
$build->{$field} = $args->{$field}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return $class->$orig($build); |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
for my $field (@ATTRIBUTE) { |
40
|
|
|
|
|
|
|
has $field => ( |
41
|
|
|
|
|
|
|
is => 'rw', |
42
|
|
|
|
|
|
|
lazy => 1, |
43
|
|
|
|
|
|
|
trigger => 1, |
44
|
|
|
|
|
|
|
default => q{} |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has [qw/template_attr row_index index data tag/] => ( |
49
|
|
|
|
|
|
|
is => 'rw', |
50
|
|
|
|
|
|
|
clearer => 1, |
51
|
|
|
|
|
|
|
builder => 1, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has attributes => ( |
55
|
|
|
|
|
|
|
is => 'rw', |
56
|
|
|
|
|
|
|
default => sub { {} } |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has [qw/inner_html wrap_html attribute_list truncate/] => ( is => 'rw' ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has [qw/children nested links before_element after_element/] => ( |
62
|
|
|
|
|
|
|
is => 'rw', |
63
|
|
|
|
|
|
|
default => sub { [] }, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
has html_tag => ( |
67
|
|
|
|
|
|
|
is => 'rw', |
68
|
|
|
|
|
|
|
default => 'table', |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _build_row_index { |
72
|
|
|
|
|
|
|
return |
73
|
|
|
|
|
|
|
defined $_[0]->attributes->{row_index} |
74
|
|
|
|
|
|
|
? delete $_[0]->attributes->{row_index} |
75
|
8631
|
50
|
|
8631
|
|
156999
|
: undef; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _build_index { |
79
|
|
|
|
|
|
|
return |
80
|
|
|
|
|
|
|
defined $_[0]->attributes->{index} |
81
|
|
|
|
|
|
|
? delete $_[0]->attributes->{index} |
82
|
8631
|
100
|
|
8631
|
|
170687
|
: undef; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub _build_template_attr { |
86
|
|
|
|
|
|
|
return |
87
|
|
|
|
|
|
|
defined $_[0]->attributes->{template_attr} |
88
|
|
|
|
|
|
|
? delete $_[0]->attributes->{template_attr} |
89
|
8631
|
100
|
|
8631
|
|
131662
|
: undef; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _build_tag { |
93
|
8631
|
|
|
8631
|
|
45824
|
my $caller = caller(); |
94
|
8631
|
|
|
|
|
30025
|
my ($tag) = $caller =~ /.*\:\:(.*)/; |
95
|
8631
|
|
|
|
|
118756
|
return lc $tag; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
0
|
0
|
0
|
sub has_data { return scalar @{ $_[0]->data } ? 1 : 0; } |
|
0
|
|
|
|
|
0
|
|
99
|
|
|
|
|
|
|
|
100
|
810
|
50
|
|
810
|
0
|
1312
|
sub has_children { return scalar @{ $_[0]->children } ? 1 : 0; } |
|
810
|
|
|
|
|
2510
|
|
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
0
|
0
|
0
|
sub count_children { return scalar @{ $_[0]->children }; } |
|
0
|
|
|
|
|
0
|
|
103
|
|
|
|
|
|
|
|
104
|
884
|
100
|
|
884
|
1
|
52781
|
sub has_nested { return scalar @{ $_[0]->nested } ? 1 : 0; } |
|
884
|
|
|
|
|
3746
|
|
105
|
|
|
|
|
|
|
|
106
|
30
|
|
|
30
|
1
|
55
|
sub count_nested { return scalar @{ $_[0]->nested }; } |
|
30
|
|
|
|
|
183
|
|
107
|
|
|
|
|
|
|
|
108
|
71
|
|
|
71
|
1
|
15390
|
sub get_first_nested { return $_[0]->nested->[0]; } |
109
|
|
|
|
|
|
|
|
110
|
14
|
|
|
14
|
1
|
78
|
sub get_nested { return $_[0]->nested->[ $_[1] ]; } |
111
|
|
|
|
|
|
|
|
112
|
11
|
|
|
11
|
1
|
24
|
sub all_nested { return @{ $_[0]->nested }; } |
|
11
|
|
|
|
|
44
|
|
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
0
|
1
|
0
|
sub has_links { return scalar @{ $_[0]->links } ? 1 : 0; } |
|
0
|
|
|
|
|
0
|
|
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
0
|
1
|
0
|
sub count_links { return scalar @{ $_[0]->links }; } |
|
0
|
|
|
|
|
0
|
|
117
|
|
|
|
|
|
|
|
118
|
7
|
|
|
7
|
1
|
33
|
sub get_first_link { return $_[0]->links->[0]; } |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
0
|
1
|
0
|
sub get_link { return $_[0]->links->[ $_[1] ]; } |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
0
|
1
|
0
|
sub all_links { return @{ $_[0]->links }; } |
|
0
|
|
|
|
|
0
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub add_child { |
125
|
0
|
|
|
0
|
0
|
0
|
my $element = $_[0]->new( $_[1] ); |
126
|
0
|
|
|
|
|
0
|
push @{ $_[0]->children }, $element; |
|
0
|
|
|
|
|
0
|
|
127
|
0
|
|
|
|
|
0
|
return $element; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub add_nested { |
131
|
1
|
|
|
1
|
1
|
25
|
my $table = HTML::TableContent::Table->new( $_[1] ); |
132
|
1
|
|
|
|
|
11
|
push @{ $_[0]->nested }, $table; |
|
1
|
|
|
|
|
5
|
|
133
|
1
|
|
|
|
|
5
|
return $table; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub add_to_nested { |
137
|
1
|
|
|
1
|
0
|
3
|
return push @{ $_[0]->nested }, $_[1]; |
|
1
|
|
|
|
|
9
|
|
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
4295
|
|
|
4295
|
1
|
358726
|
sub text { return join q{ }, @{ $_[0]->data }; } |
|
4295
|
|
|
|
|
17878
|
|
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
0
|
0
|
0
|
sub truncate_text { return substr($_[0]->text, 0, $_[0]->truncate) . '...'; } |
143
|
|
|
|
|
|
|
|
144
|
1
|
|
|
1
|
0
|
3
|
sub add_text { return push @{ $_[0]->data }, $_[1]; } |
|
1
|
|
|
|
|
7
|
|
145
|
|
|
|
|
|
|
|
146
|
4
|
|
|
4
|
0
|
71
|
sub set_text { $_[0]->data( [ $_[1] ] ); } |
147
|
|
|
|
|
|
|
|
148
|
763
|
|
|
763
|
0
|
1553
|
sub lc_text { return lc $_[0]->text; } |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
0
|
0
|
0
|
sub ucf_text { return ucfirst $_[0]->text; } |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub add_class { |
153
|
0
|
|
|
0
|
0
|
0
|
my $class = $_[0]->class; |
154
|
0
|
|
|
|
|
0
|
return $_[0]->class( sprintf( '%s %s', $class, $_[1] ) ); |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub add_style { |
158
|
1
|
|
|
1
|
0
|
20
|
my $style = $_[0]->style; |
159
|
1
|
|
|
|
|
24
|
return $_[0]->style( sprintf( '%s %s', $style, $_[1] ) ); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub raw { |
163
|
159
|
|
|
159
|
0
|
1378
|
my $args = $_[0]->attributes; |
164
|
|
|
|
|
|
|
|
165
|
159
|
100
|
|
|
|
1148
|
if ( $_[0]->has_nested ) { |
166
|
10
|
|
|
|
|
32
|
$args->{nested} = (); |
167
|
10
|
|
|
|
|
50
|
for ( $_[0]->all_nested ) { |
168
|
8
|
|
|
|
|
21
|
push @{ $args->{nested} }, $_->raw; |
|
8
|
|
|
|
|
233
|
|
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
159
|
100
|
|
|
|
278
|
if ( scalar @{ $_[0]->data } ) { |
|
159
|
|
|
|
|
525
|
|
173
|
87
|
|
|
|
|
208
|
$args->{text} = $_[0]->text; |
174
|
87
|
|
|
|
|
208
|
$args->{data} = $_[0]->data; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
159
|
|
|
|
|
521
|
return $args; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub render { |
181
|
810
|
|
|
810
|
0
|
1805
|
my $args = $_[0]->attributes; |
182
|
|
|
|
|
|
|
|
183
|
810
|
|
|
|
|
1347
|
my $attr = ''; |
184
|
810
|
|
|
|
|
1177
|
foreach my $attribute ( @{ $_[0]->attribute_list } ) { |
|
810
|
|
|
|
|
1855
|
|
185
|
19440
|
100
|
|
|
|
40759
|
if ( my $val = $args->{$attribute} ) { |
186
|
453
|
|
|
|
|
779
|
$attribute =~ s/\_/\-/g; |
187
|
453
|
50
|
|
|
|
1267
|
if ( ref $val eq 'ARRAY' ) { |
|
|
50
|
|
|
|
|
|
188
|
|
|
|
|
|
|
$val = sprintf( |
189
|
|
|
|
|
|
|
$val->[0], |
190
|
0
|
|
|
|
|
0
|
map { $_[0]->$_ } @{$val}[ 1 .. scalar @{$val} - 1 ] |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
191
|
|
|
|
|
|
|
); |
192
|
|
|
|
|
|
|
} elsif ( ref $val eq 'CODE' ) { |
193
|
0
|
|
|
|
|
0
|
$val = $val->($_[0]); |
194
|
|
|
|
|
|
|
} |
195
|
453
|
|
|
|
|
1386
|
$attr .= sprintf '%s="%s" ', $attribute, $val; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
810
|
|
|
|
|
8506
|
my $render = $_[0]->_render_element; |
201
|
|
|
|
|
|
|
|
202
|
810
|
100
|
|
|
|
2430
|
if ( my $inner_html = $_[0]->inner_html ) { |
203
|
80
|
|
|
|
|
122
|
my $inner_count = scalar @{$inner_html}; |
|
80
|
|
|
|
|
143
|
|
204
|
80
|
100
|
|
|
|
190
|
if ( $inner_count == 1 ) { |
205
|
64
|
|
|
|
|
175
|
$render = sprintf( $inner_html->[0], $render ); |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
else { |
208
|
|
|
|
|
|
|
$render = sprintf( |
209
|
|
|
|
|
|
|
$inner_html->[0], |
210
|
16
|
|
|
|
|
54
|
map { $_[0]->$_ } @{$inner_html}[ 1 .. $inner_count - 1 ] |
|
32
|
|
|
|
|
164
|
|
|
16
|
|
|
|
|
48
|
|
211
|
|
|
|
|
|
|
); |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
810
|
50
|
|
|
|
1652
|
if ($_[0]->has_children) { |
216
|
0
|
|
|
|
|
0
|
my @elements = map { $_->render } @{ $_[0]->children }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
217
|
0
|
|
|
|
|
0
|
my $ele_html = sprintf '%s' x @elements, @elements; |
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
0
|
$render = sprintf '%s%s', $render, $ele_html; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
810
|
|
|
|
|
1733
|
my $tag = $_[0]->html_tag; |
223
|
810
|
|
|
|
|
2412
|
my $html = sprintf( "<%s %s>%s%s>", $tag, $attr, $render, $tag ); |
224
|
|
|
|
|
|
|
|
225
|
810
|
50
|
|
|
|
2422
|
if ( my $before_element = $_[0]->before_element ) { |
226
|
810
|
|
|
|
|
1207
|
for ( @{$before_element} ) { |
|
810
|
|
|
|
|
1623
|
|
227
|
0
|
0
|
|
|
|
0
|
my $ren = ref \$_ eq 'SCALAR' ? $_ : $_->render; |
228
|
0
|
|
|
|
|
0
|
$html = sprintf "%s%s", $ren, $html; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
|
232
|
810
|
50
|
|
|
|
2084
|
if ( my $after_element = $_[0]->after_element ) { |
233
|
810
|
|
|
|
|
1194
|
for ( @{$after_element} ) { |
|
810
|
|
|
|
|
1376
|
|
234
|
0
|
0
|
|
|
|
0
|
my $ren = ref \$_ eq 'SCALAR' ? $_ : $_->render; |
235
|
0
|
|
|
|
|
0
|
$html = sprintf "%s%s", $html, $ren; |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
810
|
50
|
|
|
|
2004
|
if ( my $wrap_html = $_[0]->wrap_html ) { |
240
|
0
|
|
|
|
|
0
|
my $wrap_count = scalar @{$wrap_html}; |
|
0
|
|
|
|
|
0
|
|
241
|
0
|
0
|
|
|
|
0
|
if ( $wrap_count == 1 ) { |
242
|
0
|
|
|
|
|
0
|
$html = sprintf( $wrap_html->[0], $html ); |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
else { |
245
|
|
|
|
|
|
|
$html = sprintf( |
246
|
|
|
|
|
|
|
$wrap_html->[0], |
247
|
0
|
|
|
|
|
0
|
map { $_[0]->$_ } @{$wrap_html}[ 1 .. $wrap_html - 1 ] |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
248
|
|
|
|
|
|
|
); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
810
|
|
|
|
|
1839
|
return $_[0]->tidy_html($html); |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub _render_element { |
256
|
616
|
|
|
616
|
|
1481
|
return $_[0]->_render_element_text($_[0]->text); |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub _render_element_text { |
260
|
616
|
50
|
|
616
|
|
1770
|
return defined $_[0]->truncate ? $_[0]->truncate_text($_[0]->text) : $_[0]->text; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
2616
|
|
|
2616
|
|
55440
|
sub _trigger_class { return $_[0]->attributes->{class} = $_[1]; } |
264
|
|
|
|
|
|
|
|
265
|
976
|
|
|
976
|
|
25521
|
sub _trigger_id { return $_[0]->attributes->{id} = $_[1]; } |
266
|
|
|
|
|
|
|
|
267
|
18
|
|
|
18
|
|
401
|
sub _trigger_style { return $_[0]->attributes->{style} = $_[1]; } |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
0
|
|
0
|
sub _trigger_colspan { return $_[0]->attributes->{colspan} = $_[1]; } |
270
|
|
|
|
|
|
|
|
271
|
0
|
|
|
0
|
|
0
|
sub _trigger_rowspan { return $_[0]->attributes->{rowspan} = $_[1]; } |
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
0
|
|
0
|
sub _trigger_onclick { return $_[0]->attributes->{onclick} = $_[1]; } |
274
|
|
|
|
|
|
|
|
275
|
0
|
|
|
0
|
|
0
|
sub _trigger_onchange { return $_[0]->attributes->{onchange} = $_[1]; } |
276
|
|
|
|
|
|
|
|
277
|
0
|
|
|
0
|
|
0
|
sub _trigger_type { return $_[0]->attributes->{type} = $_[1]; } |
278
|
|
|
|
|
|
|
|
279
|
0
|
|
|
0
|
|
0
|
sub _trigger_value { return $_[0]->attributes->{value} = $_[1]; } |
280
|
|
|
|
|
|
|
|
281
|
0
|
|
|
0
|
|
0
|
sub _trigger_scope { return $_[0]->attributes->{scope} = $_[1]; } |
282
|
|
|
|
|
|
|
|
283
|
0
|
|
|
0
|
|
0
|
sub _trigger_onkeyup { return $_[0]->attributes->{onkeyup} = $_[1]; } |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
0
|
|
0
|
sub _trigger_placeholder { return $_[0]->attributes->{placeholder} = $_[1]; } |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
0
|
|
0
|
sub _trigger_onFocus { return $_[0]->attributes->{onFocus} = $_[1]; } |
288
|
|
|
|
|
|
|
|
289
|
0
|
|
|
0
|
|
0
|
sub _trigger_onBlur { return $_[0]->attributes->{onBlur} = $_[1]; } |
290
|
|
|
|
|
|
|
|
291
|
0
|
|
|
0
|
|
0
|
sub _trigger_role { return $_[0]->attributes->{role} = $_[1]; } |
292
|
|
|
|
|
|
|
|
293
|
0
|
|
|
0
|
|
0
|
sub _trigger_href { return $_[0]->attributes->{href} = $_[1]; } |
294
|
|
|
|
|
|
|
|
295
|
0
|
|
|
0
|
|
0
|
sub _trigger_width { return $_[0]->attributes->{width} = $_[1]; } |
296
|
|
|
|
|
|
|
|
297
|
0
|
|
|
0
|
|
0
|
sub _trigger_height { return $_[0]->attributes->{height} = $_[1]; } |
298
|
|
|
|
|
|
|
|
299
|
0
|
|
|
0
|
|
0
|
sub _trigger_data_toggle { return $_[0]->attributes->{data_toggle} = $_[1]; } |
300
|
|
|
|
|
|
|
|
301
|
0
|
|
|
0
|
|
0
|
sub _trigger_data_placement { return $_[0]->attributes->{data_placement} = $_[1]; } |
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
0
|
|
0
|
sub _trigger_title { return $_[0]->attributes->{title} = $_[1]; } |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
sub _trigger_template_attr { |
306
|
0
|
|
|
0
|
|
0
|
return $_[0]->attributes->{template_attr} = $_[1]; |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
0
|
|
|
0
|
|
0
|
sub _trigger_selected { return $_[0]->attributes->{selected} = $_[1]; } |
310
|
|
|
|
|
|
|
|
311
|
0
|
|
|
0
|
|
0
|
sub _trigger_autocomplete { return $_[0]->attributes->{autocomplete} = $_[1]; } |
312
|
|
|
|
|
|
|
|
313
|
0
|
|
|
0
|
|
0
|
sub _trigger_for { return $_[0]->attributes->{for} = $_[1]; } |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
sub _build_data { |
316
|
8631
|
|
|
8631
|
|
40432
|
my $data = delete $_[0]->attributes->{data}; |
317
|
8631
|
|
|
|
|
16412
|
my $text = delete $_[0]->attributes->{text}; |
318
|
|
|
|
|
|
|
|
319
|
8631
|
100
|
|
|
|
20937
|
if ( defined $text ) { |
320
|
3715
|
|
|
|
|
5630
|
push @{$data}, $text; |
|
3715
|
|
|
|
|
9438
|
|
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
8631
|
50
|
100
|
|
|
19999
|
return $data if defined $data && scalar @{$data}; |
|
3715
|
|
|
|
|
52748
|
|
324
|
4916
|
|
|
|
|
66316
|
return []; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
0
|
0
|
|
0
|
0
|
0
|
sub has_id { return length $_[0]->id ? 1 : 0; } |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub tidy_html { |
330
|
810
|
|
|
810
|
0
|
4000
|
$_[1] =~ s/\s+>/>/g; |
331
|
810
|
|
|
|
|
3309
|
return $_[1]; |
332
|
|
|
|
|
|
|
} |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
1; |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
__END__ |