1 # Blosxom Plugin: flavourdir
2 # Author(s): Rael Dornfest <rael@oreilly.com>
4 # Documentation: See the bottom of this file or type: perldoc flavourdir
8 # --- Configurable variables -----
10 # Where might I find your flavours?
11 my $flavour_dir = "$blosxom::datadir/flavours";
13 # Should I fall back to looking in your Blosxom datadir before using the
14 # default built-in templates?
16 my $fallback_to_datadir = 0;
18 # --------------------------------
21 my $fh = new FileHandle;
29 my ($path, $chunk, $flavour) = @_;
31 $path =~ s!^/*!!; $path = "/$path";
35 return join '', <$fh> if $fh->open("< $flavour_dir/$p/$chunk.$flavour");
36 } while ($p =~ s/(\/*[^\/]*)$// and $1);
39 $fallback_to_datadir and do {
40 return join '', <$fh> if $fh->open("< $blosxom::datadir/$p/$chunk.$flavour");
41 } while ($p =~ s/(\/*[^\/]*)$// and $1);
43 return join '', ($blosxom::template{$flavour}{$chunk} || $blosxom::template{error}{$chunk} || '');
53 Blosxom Plug-in: flavourdir
57 Keep your flavours in a separate flavour directory rather than alongside all of your weblog entries. Optionally falls back to the default of looking in your Blosxom datadir.
59 Overrides Blosxom's default template() subroutine.
61 Respects the Blosxom concept of finding flavours along specific paths, expecting to find these paths echoed in your flavour directory.
63 =head1 INSTALLATION AND CONFIGURATION
65 Drop the flavourdir plug-in into your Blosxom plugins folder.
67 The plug-in is preconfigured to assume a flavour directory beneath your Blosxom data directory. Alter the $flavour_dir configurable variable to move it elsewhere.
69 If you'd like the plug-in to fall back to looking in your Blosxom data directory if it doesn't find the appropriate flavour in your flavour directory, set the $fallback_to_datadir configurable variable to 1. Note: This results in additional processing and isn't a particularly efficient use of a plug-in's time.
77 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
79 This plugin is now maintained by the Blosxom Sourceforge Team,
80 <blosxom-devel@lists.sourceforge.net>.
84 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
86 Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
90 None known; please send bug reports and feedback to the Blosxom
91 development mailing list <blosxom-devel@lists.sourceforge.net>.
95 Blosxom and this Blosxom Plug-in
96 Copyright 2003, Rael Dornfest
98 Permission is hereby granted, free of charge, to any person obtaining a
99 copy of this software and associated documentation files (the "Software"),
100 to deal in the Software without restriction, including without limitation
101 the rights to use, copy, modify, merge, publish, distribute, sublicense,
102 and/or sell copies of the Software, and to permit persons to whom the
103 Software is furnished to do so, subject to the following conditions:
105 The above copyright notice and this permission notice shall be included
106 in all copies or substantial portions of the Software.
108 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
109 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
110 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
111 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
112 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
113 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
114 OTHER DEALINGS IN THE SOFTWARE.