| HTML-Widgets-NavMenu documentation | Contained in the HTML-Widgets-NavMenu distribution. |
HTML::Widgets::NavMenu::TagGen - class to generate tags.
For internal use only.
For internal use.
For internal use.
Generate the tag.
| HTML-Widgets-NavMenu documentation | Contained in the HTML-Widgets-NavMenu distribution. |
package HTML::Widgets::NavMenu::TagGen; use strict; use warnings; use base 'HTML::Widgets::NavMenu::Object'; use HTML::Widgets::NavMenu::EscapeHtml; __PACKAGE__->mk_acc_ref([ qw(name attributes)] );
sub _init { my ($self, $args) = @_; $self->name($args->{'name'}); $self->attributes($args->{'attributes'}); return 0; }
sub gen { my $self = shift; my $attr_values = shift; my $is_standalone = shift || 0; my @tag_list = keys(%$attr_values); @tag_list = (grep { defined($attr_values->{$_}) } @tag_list); @tag_list = (sort { $a cmp $b } @tag_list); my $attr_spec = $self->attributes(); return "<" . $self->name() . join("", map { " $_=\"" . ($attr_spec->{$_}->{'escape'} ? escape_html($attr_values->{$_}) : $attr_values->{$_} ) . "\"" } @tag_list) . ($is_standalone ? " /" : "") . ">"; } 1;