You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by ni...@apache.org on 2010/11/22 23:21:44 UTC
svn commit: r1037919 - /comdev/site/trunk/lib/view.pm
Author: nick
Date: Mon Nov 22 22:21:44 2010
New Revision: 1037919
URL: http://svn.apache.org/viewvc?rev=1037919&view=rev
Log:
Fix breadcrumb links
Modified:
comdev/site/trunk/lib/view.pm
Modified: comdev/site/trunk/lib/view.pm
URL: http://svn.apache.org/viewvc/comdev/site/trunk/lib/view.pm?rev=1037919&r1=1037918&r2=1037919&view=diff
==============================================================================
--- comdev/site/trunk/lib/view.pm (original)
+++ comdev/site/trunk/lib/view.pm Mon Nov 22 22:21:44 2010
@@ -52,20 +52,26 @@ sub normal_page {
# Generates cwiki-style breadcrumbs
sub breadcrumbs {
my ($fullpath, $headerref) = @_;
- my @path = split m!/!, $fullpath;
- if($path[scalar@path-1] =~ /^index/) {
- pop @path;
+ my @titles = split m!/!, $fullpath;
+ my @paths = split m!/!, $fullpath;
+
+ if($paths[scalar@paths-1] =~ /^index/) {
+ pop @titles;
+ pop @paths;
} else {
if($headerref && $headerref->{title}) {
- $path[scalar@path-1] = $headerref->{title};
+ $titles[scalar@titles-1] = $headerref->{title};
}
}
+ $titles[0] = "Home";
+
my @rv;
- my $relpath = "";
- for (@path) {
- $relpath .= "$_/";
- $_ ||= "Home";
- push @rv, qq(<a href="$relpath">\u$_</a>);
+ my $relpath = "/";
+ for(my $i=0; $i<scalar @paths; $i++) {
+ my $title = $titles[$i];
+ $relpath .= $paths[$i];
+ push @rv, qq(<a href="$relpath">\u$title</a>);
+ unless($relpath eq "/") { $relpath .= "/"; }
}
return join " » ", @rv;
}