1 # Blosxom Plugin: breadcrumbs
2 # Author(s): Rael Dornfest <rael@oreilly.com>
4 # Documentation: See the bottom of this file or type: perldoc readme
8 # --- Configurable variables -----
10 # Should I prepend a link back home to the path?
11 # Specify a word to use for the link back to $blosxom::url or leave blank
16 # What divider should I use between path components (e.g. a > path > to...)
19 # True or false: should we show a breadcrumb containing only $home
20 # when looking at $blosxom::url? Optional; default is false.
21 my $home_breadcrumb = 0;
23 # Code reference which is applied to each path name to make it more
24 # user friendly. Example : { ucfirst } to capitalize first letter.
25 # Value to modify is in $_; change $_ to what should be displayed.
26 # Optional; set to undef for no action.
28 # Example: Convert each word to upper case, and change - or _ to space:
29 # my $pretty = sub { my @words = split /[-_]+/;
30 # $_=join(" ", map { ucfirst} @words ) };
31 my $pretty = sub { my @words = split /[-_]+/;
32 $_=join(" ", map { ucfirst} @words ) };
34 # --------------------------------
36 $breadcrumbs; # use as $breadcrumbs::breadcrumbs in flavour templates
40 my $fh = new FileHandle;
47 my($pkg, $path, $head_ref) = @_;
50 $breadcrumbs = $home if $home && $home_breadcrumb;
54 $path =~ s/\.$blosxom::flavour$//;
57 $home and push @p, qq{<a href="$blosxom::url/index.$blosxom::flavour">$home</a>};
59 foreach ( split /\//, $path ) {
62 &$pretty if ref $pretty eq "CODE";
65 ? qq{<a href="$blosxom::url$p/index.$blosxom::flavour">$_</a>}
69 $breadcrumbs = join $divider, @p;
80 Blosxom Plug-in: breadcrumbs
84 Populates $breadcrumbs::breadcrumbs with a clickable trail to
85 your current path in the weblog hierarchy (a la Yahoo!).
87 e.g. a/path/to/somewhere becomes
88 <a href="/a">a</a> :: <a href="/a/path">path</a> :: ...
90 Optionally prepends the path with a link back to home. Alter $home
91 as you please, leaving it blank to turn off the link to home.
97 Version number coincides with the version of Blosxom with which the
98 current version was first bundled.
102 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
104 This plugin is now maintained by the Blosxom Sourceforge Team,
105 <blosxom-devel@lists.sourceforge.net>.
109 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
111 Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
115 None known; please send bug reports and feedback to the Blosxom
116 development mailing list <blosxom-devel@lists.sourceforge.net>.
120 Blosxom and this Blosxom Plug-in
121 Copyright 2003, Rael Dornfest
123 Permission is hereby granted, free of charge, to any person obtaining a
124 copy of this software and associated documentation files (the "Software"),
125 to deal in the Software without restriction, including without limitation
126 the rights to use, copy, modify, merge, publish, distribute, sublicense,
127 and/or sell copies of the Software, and to permit persons to whom the
128 Software is furnished to do so, subject to the following conditions:
130 The above copyright notice and this permission notice shall be included
131 in all copies or substantial portions of the Software.
133 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
134 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
135 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
136 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
137 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
138 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
139 OTHER DEALINGS IN THE SOFTWARE.