X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom-plugins.git;a=blobdiff_plain;f=general%2Fbreadcrumbs;h=bc7b3029a61a8d4fe32c6715df22c07de0bf68c7;hp=f7f74d779d3a22c0d9f55a547742f48aa47bd801;hb=HEAD;hpb=ebb08aa6d3f16303068fc794c1135dcbc8a5be0e diff --git a/general/breadcrumbs b/general/breadcrumbs index f7f74d7..bc7b302 100644 --- a/general/breadcrumbs +++ b/general/breadcrumbs @@ -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{$_} : qq{$_}; @@ -81,16 +101,19 @@ current version was first bundled. Rael Dornfest , http://www.raelity.org/ +This plugin is now maintained by the Blosxom Sourceforge Team, +. + =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 . =head1 LICENSE