/usr/share/perl5/HTML/Widgets/NavMenu/Iterator/Html.pm is in libhtml-widgets-navmenu-perl 1.0703-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | package HTML::Widgets::NavMenu::Iterator::Html::Item;
use strict;
use warnings;
use base qw(HTML::Widgets::NavMenu::Tree::Iterator::Item);
sub get_url_type
{
my $item = shift;
return
($item->_node()->url_type() ||
$item->_accum_state()->{'rec_url_type'} ||
"rel");
}
package HTML::Widgets::NavMenu::Iterator::Html;
=head1 NAME
HTML::Widgets::NavMenu::Iterator::Html - an iterator for HTML.
=head1 SYNOPSIS
For internal use only.
=head1 METHODS
=cut
use base qw(HTML::Widgets::NavMenu::Iterator::Base);
use HTML::Widgets::NavMenu::EscapeHtml;
sub _construct_new_item
{
my $self = shift;
my $args = shift;
return HTML::Widgets::NavMenu::Iterator::Html::Item->new(
$args,
);
}
=head2 $self->node_start()
Gets called upon node start.
=cut
sub node_start
{
my $self = shift;
if ($self->_is_root())
{
return $self->_start_root();
}
elsif ($self->_is_top_separator())
{
# _start_sep() is short for start_separator().
return $self->_start_sep();
}
else
{
return $self->_start_regular();
}
}
=head2 $self->node_end()
Gets called upon node end.
=cut
sub node_end
{
my $self = shift;
if ($self->_is_root())
{
return $self->end_root();
}
elsif ($self->_is_top_separator())
{
return $self->_end_sep();
}
else
{
return $self->_end_regular();
}
}
=head2 $self->end_root()
End-root event.
=cut
sub end_root
{
my $self = shift;
$self->_add_tags("</ul>");
}
sub _end_regular
{
my $self = shift;
if ($self->top()->_num_subs() && $self->_is_expanded())
{
$self->_add_tags("</ul>");
}
$self->_add_tags("</li>");
}
=head2 $self->node_should_recurse()
Override to determine when one should recurse to the node.
=cut
sub node_should_recurse
{
my $self = shift;
return $self->_is_expanded();
}
=head2 $self->get_a_tag()
Renders the HTML for the opening a-tag.
=cut
# Get the HTML <a href=""> tag.
#
sub get_a_tag
{
my $self = shift;
my $item = $self->top();
my $node = $item->_node;
my $tag ="<a";
my $title = $node->title;
$tag .= " href=\"" .
escape_html(
$self->nav_menu()->_get_url_to_item($item)
). "\"";
if (defined($title))
{
$tag .= " title=\"$title\"";
}
$tag .= ">" . $node->text() . "</a>";
return $tag;
}
=head1 COPYRIGHT & LICENSE
Copyright 2006 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.
=cut
1;
|