celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1071230 - /incubator/celix/site/trunk/lib/view.pm
Date Wed, 16 Feb 2011 12:43:55 GMT
Author: abroekhuis
Date: Wed Feb 16 12:43:55 2011
New Revision: 1071230

URL: http://svn.apache.org/viewvc?rev=1071230&view=rev
Log:
Updated export lib

Modified:
    incubator/celix/site/trunk/lib/view.pm

Modified: incubator/celix/site/trunk/lib/view.pm
URL: http://svn.apache.org/viewvc/incubator/celix/site/trunk/lib/view.pm?rev=1071230&r1=1071229&r2=1071230&view=diff
==============================================================================
--- incubator/celix/site/trunk/lib/view.pm (original)
+++ incubator/celix/site/trunk/lib/view.pm Wed Feb 16 12:43:55 2011
@@ -28,11 +28,12 @@ sub single_narrative {
     my %args = @_;
     my $file = "content$args{path}";
     my $template = $args{template};
+    $args{infopath} = $args{path};
+    $args{infopath} =~ s/\.mdtext$/\-links.mdtext/;
     $args{path} =~ s/\.mdtext$/\.html/;
-    $args{breadcrumbs} = breadcrumbs($args{path});
 
     read_text_file $file, \%args;
-
+    
     my $page_path = $file;
     $page_path =~ s/\.[^.]+$/.page/;
     if (-d $page_path) {
@@ -46,11 +47,7 @@ sub single_narrative {
 #	$args{sidenav} = {};
 #	read_text_file "templates/sidenav.mdtext", $args{sidenav} ;
 
-#	select STDOUT ;
-#	$| = 1 ;
-#	for my $ke (keys %args) {
-#		print STDOUT "$ke \n";
-#	}
+    $args{breadcrumbs} = breadcrumbs($args{path}, $args{headers});
 
     return Template($template)->render(\%args), html => \%args;
 }
@@ -165,21 +162,37 @@ sub fetch_doap_url_list {
     return @urls;
 }
 
-1;
-
 sub breadcrumbs {
-    my @path = split m!/!, shift;
-    pop @path;
+    my ($fullpath, $headerref) = @_;
+    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}) {
+         $titles[scalar@titles-1] = $headerref->{title};
+      }
+    }
+    $titles[1] = "Home";
+
     my @rv;
-    my $relpath = "";
-    for (@path) {
-        $relpath .= "$_/";
-        $_ ||= "Home";
-        push @rv, qq(<a href="$relpath">\u$_</a>);
+    my $relpath = "/";
+    for(my $i=1; $i<scalar @paths; $i++) {
+        my $title = $titles[$i];
+        $relpath .= $paths[$i];
+        if($i == scalar@paths-1) {
+            push @rv, qq(<li>\u$title</li>);
+        } else {
+            push @rv, qq(<li><a href="$relpath">\u$title</a></li>);
+        }
+        unless($relpath eq "/") { $relpath .= "/"; }
     }
-    return join "&nbsp;&raquo&nbsp;", @rv;
+    return join "", @rv;
 }
 
+1;
 
 =head1 LICENSE
 



Mime
View raw message