line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widgets::NavMenu::Iterator::Html; |
2
|
|
|
|
|
|
|
$HTML::Widgets::NavMenu::Iterator::Html::VERSION = '1.0902'; |
3
|
11
|
|
|
11
|
|
4350
|
use strict; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
249
|
|
4
|
11
|
|
|
11
|
|
44
|
use warnings; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
213
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
4202
|
use HTML::Widgets::NavMenu::Iterator::Html::Item (); |
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
212
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
|
60
|
use parent qw(HTML::Widgets::NavMenu::Iterator::Base); |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
48
|
|
10
|
|
|
|
|
|
|
|
11
|
11
|
|
|
11
|
|
4469
|
use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /; |
|
11
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
5295
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _construct_new_item |
14
|
|
|
|
|
|
|
{ |
15
|
979
|
|
|
979
|
|
1453
|
my $self = shift; |
16
|
979
|
|
|
|
|
1243
|
my $args = shift; |
17
|
|
|
|
|
|
|
|
18
|
979
|
|
|
|
|
1824
|
return HTML::Widgets::NavMenu::Iterator::Html::Item->new( $args, ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _is_top_separator |
23
|
|
|
|
|
|
|
{ |
24
|
494
|
|
|
494
|
|
944
|
return $_[0]->top->{_node}->{separator}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub node_start |
28
|
|
|
|
|
|
|
{ |
29
|
297
|
|
|
297
|
1
|
384
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
297
|
100
|
|
|
|
629
|
if ( $self->{_is_root} ) |
|
|
100
|
|
|
|
|
|
32
|
|
|
|
|
|
|
{ |
33
|
50
|
|
|
|
|
149
|
return $self->_start_root(); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif ( $self->_is_top_separator() ) |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
# _start_sep() is short for start_separator(). |
38
|
3
|
|
|
|
|
12
|
return $self->_start_sep(); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else |
41
|
|
|
|
|
|
|
{ |
42
|
244
|
|
|
|
|
507
|
return $self->_start_regular(); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub node_end |
48
|
|
|
|
|
|
|
{ |
49
|
297
|
|
|
297
|
1
|
394
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
297
|
100
|
|
|
|
596
|
if ( $self->{_is_root} ) |
|
|
100
|
|
|
|
|
|
52
|
|
|
|
|
|
|
{ |
53
|
50
|
|
|
|
|
186
|
return $self->end_root(); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
elsif ( $self->_is_top_separator() ) |
56
|
|
|
|
|
|
|
{ |
57
|
3
|
|
|
|
|
24
|
return $self->_end_sep(); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
else |
60
|
|
|
|
|
|
|
{ |
61
|
244
|
|
|
|
|
506
|
return $self->_end_regular(); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub end_root |
67
|
|
|
|
|
|
|
{ |
68
|
50
|
|
|
50
|
1
|
70
|
my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
50
|
|
|
|
|
113
|
$self->_add_tags(""); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _end_regular |
74
|
|
|
|
|
|
|
{ |
75
|
236
|
|
|
236
|
|
284
|
my $self = shift; |
76
|
236
|
100
|
100
|
|
|
396
|
if ( $self->top()->_num_subs() && $self->_is_expanded() ) |
77
|
|
|
|
|
|
|
{ |
78
|
51
|
|
|
|
|
120
|
$self->_add_tags(""); |
79
|
|
|
|
|
|
|
} |
80
|
236
|
|
|
|
|
520
|
$self->_add_tags(""); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub node_should_recurse |
85
|
|
|
|
|
|
|
{ |
86
|
544
|
|
|
544
|
1
|
692
|
my $self = shift; |
87
|
544
|
|
|
|
|
937
|
return $self->_is_expanded(); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Get the HTML tag. |
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
sub get_a_tag |
94
|
|
|
|
|
|
|
{ |
95
|
215
|
|
|
215
|
1
|
299
|
my $self = shift; |
96
|
215
|
|
|
|
|
350
|
my $item = $self->top(); |
97
|
215
|
|
|
|
|
324
|
my $node = $item->_node; |
98
|
|
|
|
|
|
|
|
99
|
215
|
|
|
|
|
300
|
my $tag = "
|
100
|
215
|
|
|
|
|
343
|
my $title = $node->title; |
101
|
|
|
|
|
|
|
|
102
|
215
|
|
|
|
|
641
|
$tag .= " href=\"" |
103
|
|
|
|
|
|
|
. escape_html( $self->nav_menu()->_get_url_to_item($item) ) . "\""; |
104
|
215
|
100
|
|
|
|
590
|
if ( defined($title) ) |
105
|
|
|
|
|
|
|
{ |
106
|
71
|
|
|
|
|
164
|
$tag .= " title=\"$title\""; |
107
|
|
|
|
|
|
|
} |
108
|
215
|
|
|
|
|
507
|
$tag .= ">" . $node->text() . ""; |
109
|
215
|
|
|
|
|
585
|
return $tag; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |