shlomi-fish-homepage / bin / Test / render-breadcrumbs-trail.pl

#!/usr/bin/perl 

use strict;
use warnings;
use MyNavData;
use HTML::Widgets::NavMenu;
use CGI qw();
use MyNavLinks;

my $my_THE_filename = "puzzles/situation/book-under-rock.html";
{
my $filename = $my_THE_filename;
$filename =~ s{index\.html$}{};
$filename = "/$filename";

use vars qw($nav_bar);

$nav_bar = HTML::Widgets::NavMenu->new(
    'path_info' => $filename,
    'current_host' => "t2",
    MyNavData::get_params(),
    'ul_classes' => [ "navbarmain", ("navbarnested") x 10 ],
    );

my $rendered_results = $nav_bar->render();

use vars qw($nav_links);

$nav_links = $rendered_results->{nav_links};

use vars qw($nav_links_obj);

$nav_links_obj = $rendered_results->{nav_links_obj};

use vars qw($nav_html);

$nav_html = $rendered_results->{html};

use vars qw($leading_path);
$leading_path = $rendered_results->{leading_path};

my $render_leading_path_component = sub {
    my $component = shift;
    my $title = $component->title();
    my $title_attr = defined($title) ? " title=\"$title\"" : "";
    return "<a href=\"" . CGI::escapeHTML($component->direct_url()) .
        "\"$title_attr>" .
        $component->label() . "</a>";
};

use vars qw($leading_path_string);

$leading_path_string =
    join(" &rarr; ",
        (map
        { $render_leading_path_component->($_) }
        @$leading_path
        ));

use vars qw($nav_links_renderer);

$nav_links_renderer = MyNavLinks->new(
        'nav_links' => $nav_links,
        'nav_links_obj' => $nav_links_obj,
        'root' => "../..",
        );
    }

    use MySectNavData;

    use vars (qw($section_nav_menu));

    sub init_section_nav_menu
    {
        if (defined($section_nav_menu))
        {
            return;
        }
    my $filename = $my_THE_filename;
    $filename =~ s{index\.html$}{};
    $filename = "/$filename";

    $section_nav_menu = MySectNavData::get_nav_menu(
        'path_info' => $filename,
        'current_host' => "t2",
        'root' => "../..",
        );

return;
    }

    init_section_nav_menu();
    my $total_leading_path = $section_nav_menu->total_leading_path(
        {
            main_leading_path => $leading_path,
        }
    );

    my $render_leading_path_component = sub {
        my $component = shift;
        my $title = $component->title();
        my $title_attr = defined($title) ? " title=\"$title\"" : "";
        return "<a href=\"" . CGI::escapeHTML($component->direct_url()) .
            "\"$title_attr>" .
            $component->label() . "</a>";
    };

    print join(" &rarr; ",
        (map
        { $render_leading_path_component->($_) }
        @$total_leading_path
        ));
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.