« blib/lib/HTML/Latemp/NavLinks/GenHtml.pm
↑ Summary
blib/lib/HTML/Latemp/NavLinks/GenHtml/ArrowImages.pm »
| 1 | package HTML::Latemp::NavLinks::GenHtml::Text; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | our $VERSION = '0.2.6'; | |
| 7 | |||
| 8 | 3 | ▶ | use vars qw($nav_buttons_html); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | ▶ | use parent 'HTML::Latemp::NavLinks::GenHtml'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | |||
| 13 | 3 | __PACKAGE__->mk_accessors(qw( | |
| 14 | nav_links | ||
| 15 | root | ||
| 16 | )); | ||
| 17 | |||
| 18 | 3 | ▶ | use Template; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | |||
| 20 | # load Template::Stash to make method tables visible | ||
| 21 | 3 | ▶ | use Template::Stash; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | # Define a method to return a substring. | ||
| 24 | $Template::Stash::SCALAR_OPS->{ 'substr' } = sub { | ||
| 25 | 0 | ▶ | return substr($_[0], $_[1], $_[2]); |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 26 | 3 | }; | |
| 27 | |||
| 28 | sub _get_nav_buttons_html | ||
| 29 | { | ||
| 30 | 0 | ▶ | my $self = shift; |
|
Subroutine
_get_nav_buttons_html: not called CC=1 SCAR=6.9
| |||
| 31 | |||
| 32 | 0 | my (%args) = (@_); | |
| 33 | |||
| 34 | 0 | my $with_accesskey = $args{'with_accesskey'}; | |
| 35 | |||
| 36 | 0 | my $root = $self->root(); | |
| 37 | |||
| 38 | 0 | my $template = | |
| 39 | Template->new( | ||
| 40 | { | ||
| 41 | 'POST_CHOMP' => 1, | ||
| 42 | } | ||
| 43 | ); | ||
| 44 | |||
| 45 | 0 | my $vars = | |
| 46 | { | ||
| 47 | 'buttons' => $self->_get_buttons(), | ||
| 48 | 'root' => $root, | ||
| 49 | 'with_accesskey' => $with_accesskey, | ||
| 50 | }; | ||
| 51 | |||
| 52 | 0 | my $nav_links_template = <<'EOF'; | |
| 53 | [% USE HTML %] | ||
| 54 | [% FOREACH b = buttons %] | ||
| 55 | [% SET key = b.dir.substr(0, 1) %] | ||
| 56 | <li>[ | ||
| 57 | [% IF b.exists %] | ||
| 58 | <a href="[% HTML.escape(b.link_obj.direct_url()) %]" title="[% b.title %] (Alt+[% key FILTER upper %])" | ||
| 59 | [% IF with_accesskey %] | ||
| 60 | accesskey="[% key %]" | ||
| 61 | [% END %] | ||
| 62 | >[% END %] [% b.dir %] [% IF b.exists %]</a> | ||
| 63 | [% END %] | ||
| 64 | ]</li> | ||
| 65 | [% END %] | ||
| 66 | EOF | ||
| 67 | |||
| 68 | 0 | my $nav_buttons_html = ""; | |
| 69 | |||
| 70 | 0 | $template->process(\$nav_links_template, $vars, \$nav_buttons_html); | |
| 71 | 0 | return $nav_buttons_html; | |
| 72 | } | ||
| 73 | |||
| 74 | sub get_total_html | ||
| 75 | { | ||
| 76 | 0 | ▶ | my $self = shift; |
|
Subroutine
get_total_html: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 77 | |||
| 78 | 0 | return "<ul class=\"nav_links\">\n" . | |
| 79 | $self->_get_nav_buttons_html(@_) . | ||
| 80 | "\n</ul>"; | ||
| 81 | } | ||
| 82 | |||
| 83 | 3 | 1; | |
| 84 | |||
| 85 | __END__ | ||