line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widgets::NavMenu::Iterator::Html; |
2
|
|
|
|
|
|
|
$HTML::Widgets::NavMenu::Iterator::Html::VERSION = '1.1000'; |
3
|
11
|
|
|
11
|
|
4180
|
use strict; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
250
|
|
4
|
11
|
|
|
11
|
|
46
|
use warnings; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
213
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
3912
|
use HTML::Widgets::NavMenu::Iterator::Html::Item (); |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
212
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
|
58
|
use parent qw(HTML::Widgets::NavMenu::Iterator::Base); |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
42
|
|
10
|
|
|
|
|
|
|
|
11
|
11
|
|
|
11
|
|
4457
|
use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /; |
|
11
|
|
|
|
|
29
|
|
|
11
|
|
|
|
|
6743
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _construct_new_item |
14
|
|
|
|
|
|
|
{ |
15
|
979
|
|
|
979
|
|
1434
|
my $self = shift; |
16
|
979
|
|
|
|
|
1139
|
my $args = shift; |
17
|
|
|
|
|
|
|
|
18
|
979
|
|
|
|
|
1868
|
return HTML::Widgets::NavMenu::Iterator::Html::Item->new( $args, ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _is_top_separator |
23
|
|
|
|
|
|
|
{ |
24
|
494
|
|
|
494
|
|
896
|
return $_[0]->top->{_node}->{separator}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub node_start |
28
|
|
|
|
|
|
|
{ |
29
|
297
|
|
|
297
|
1
|
384
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
297
|
100
|
|
|
|
582
|
if ( $self->{_is_root} ) |
|
|
100
|
|
|
|
|
|
32
|
|
|
|
|
|
|
{ |
33
|
50
|
|
|
|
|
129
|
return $self->_start_root(); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif ( $self->_is_top_separator() ) |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
# _start_sep() is short for start_separator(). |
38
|
3
|
|
|
|
|
9
|
return $self->_start_sep(); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else |
41
|
|
|
|
|
|
|
{ |
42
|
244
|
|
|
|
|
458
|
return $self->_start_regular(); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub node_end |
48
|
|
|
|
|
|
|
{ |
49
|
297
|
|
|
297
|
1
|
404
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
297
|
100
|
|
|
|
588
|
if ( $self->{_is_root} ) |
|
|
100
|
|
|
|
|
|
52
|
|
|
|
|
|
|
{ |
53
|
50
|
|
|
|
|
123
|
return $self->end_root(); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
elsif ( $self->_is_top_separator() ) |
56
|
|
|
|
|
|
|
{ |
57
|
3
|
|
|
|
|
8
|
return $self->_end_sep(); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
else |
60
|
|
|
|
|
|
|
{ |
61
|
244
|
|
|
|
|
453
|
return $self->_end_regular(); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub end_root |
67
|
|
|
|
|
|
|
{ |
68
|
50
|
|
|
50
|
1
|
76
|
my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
50
|
|
|
|
|
100
|
$self->_add_tags(""); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _end_regular |
74
|
|
|
|
|
|
|
{ |
75
|
236
|
|
|
236
|
|
311
|
my $self = shift; |
76
|
236
|
100
|
100
|
|
|
464
|
if ( $self->top()->_num_subs() && $self->_is_expanded() ) |
77
|
|
|
|
|
|
|
{ |
78
|
51
|
|
|
|
|
108
|
$self->_add_tags(""); |
79
|
|
|
|
|
|
|
} |
80
|
236
|
|
|
|
|
472
|
$self->_add_tags(""); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub node_should_recurse |
85
|
|
|
|
|
|
|
{ |
86
|
544
|
|
|
544
|
1
|
689
|
my $self = shift; |
87
|
544
|
|
|
|
|
939
|
return $self->_is_expanded(); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Get the HTML tag. |
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
sub get_a_tag |
94
|
|
|
|
|
|
|
{ |
95
|
215
|
|
|
215
|
1
|
285
|
my $self = shift; |
96
|
215
|
|
|
|
|
354
|
my $item = $self->top(); |
97
|
215
|
|
|
|
|
290
|
my $node = $item->_node; |
98
|
|
|
|
|
|
|
|
99
|
215
|
|
|
|
|
289
|
my $tag = "
|
100
|
215
|
|
|
|
|
363
|
my $title = $node->title; |
101
|
|
|
|
|
|
|
|
102
|
215
|
|
|
|
|
541
|
$tag .= " href=\"" |
103
|
|
|
|
|
|
|
. escape_html( $self->nav_menu()->_get_url_to_item($item) ) . "\""; |
104
|
215
|
100
|
|
|
|
549
|
if ( defined($title) ) |
105
|
|
|
|
|
|
|
{ |
106
|
71
|
|
|
|
|
162
|
$tag .= " title=\"$title\""; |
107
|
|
|
|
|
|
|
} |
108
|
215
|
|
|
|
|
495
|
$tag .= ">" . $node->text() . ""; |
109
|
215
|
|
|
|
|
586
|
return $tag; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |