tagging: Allow using titles in for related stories.
[matthijs/upstream/blosxom-plugins.git] / general / breadcrumbs
index f7f74d779d3a22c0d9f55a547742f48aa47bd801..bc7b3029a61a8d4fe32c6715df22c07de0bf68c7 100644 (file)
@@ -16,6 +16,21 @@ my $home = 'home';
 # What divider should I use between path components (e.g. a > path > to...)
 my $divider = " :: ";
 
+# True or false: should we show a breadcrumb containing only $home
+# when looking at $blosxom::url?  Optional; default is false.
+my $home_breadcrumb = 0;
+
+# Code reference which is applied to each path name to make it more
+# user friendly.  Example : { ucfirst } to capitalize first letter.
+# Value to modify is in $_; change $_ to what should be displayed.
+# Optional; set to undef for no action.
+#
+# Example: Convert each word to upper case, and change - or _ to space:
+# my $pretty = sub { my @words = split /[-_]+/;
+#                    $_=join(" ", map { ucfirst} @words ) };
+my $pretty = sub { my @words = split /[-_]+/;
+                   $_=join(" ", map { ucfirst} @words ) };
+
 # --------------------------------
 
 $breadcrumbs; # use as $breadcrumbs::breadcrumbs in flavour templates
@@ -31,7 +46,11 @@ sub start {
 sub head {
   my($pkg, $path, $head_ref) = @_;
 
-  $path or return 0;
+  unless($path) {
+    $breadcrumbs = $home if $home && $home_breadcrumb;
+    return 0;
+  }
+
   $path =~ s/\.$blosxom::flavour$//;
 
   my(@p, $p);
@@ -40,7 +59,8 @@ sub head {
   foreach ( split /\//, $path ) {
     $p .= "/$_";
 
-    push @p, 
+    &$pretty if ref $pretty eq "CODE";
+    push @p,
       $p ne "/$path"
       ? qq{<a href="$blosxom::url$p/index.$blosxom::flavour">$_</a>}
       : qq{$_};
@@ -81,16 +101,19 @@ current version was first bundled.
 
 Rael Dornfest  <rael@oreilly.com>, http://www.raelity.org/
 
+This plugin is now maintained by the Blosxom Sourceforge Team,
+<blosxom-devel@lists.sourceforge.net>.
+
 =head1 SEE ALSO
 
-Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
+Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
 
-Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
+Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
 
 =head1 BUGS
 
-Address bug reports and comments to the Blosxom mailing list 
-[http://www.yahoogroups.com/group/blosxom].
+None known; please send bug reports and feedback to the Blosxom
+development mailing list <blosxom-devel@lists.sourceforge.net>.
 
 =head1 LICENSE