1 # Blosxom Plugin: postheadprefoot
2 # Author(s): Rael Dornfest <rael@oreilly.com>
4 # Documentation: See the bottom of this file or type: perldoc postheadprefoot
6 package postheadprefoot;
8 # --- Configurable variables -----
10 # How should I decorate my posthead, if at all?
11 # A dressed up version might look like:
12 # my $posthead = '<span class="head">$posthead</span>';
13 # The default is plain and simple:
14 my $posthead = '$posthead';
16 # How should I decorate my prefoot, if at all?
17 # A dressed up version might look like:
18 # my $prefoot = '<span class="foot">$prefoot</span>';
19 # The default is plain and simple:
20 my $prefoot = '$prefoot';
22 # --------------------------------
26 my $fh = new FileHandle;
33 my($pkg, $path, $head_ref) = @_;
35 $posthead =~ s!\$posthead!load($path, 'posthead')!eis;
36 $$head_ref .= $posthead;
42 my($pkg, $path, $foot_ref) = @_;
44 $prefoot =~ s!\$prefoot!load($path, 'prefoot')!eis;
45 $$foot_ref = $prefoot . $$foot_ref;
51 my($path, $chunk) = @_;
53 my($path,$fn) = $path =~ m!^(?:(.*)/)?(.*)\.$blosxom::flavour!;
55 $path =~ s!^/*!!; $path &&= "/$path";
58 $fh->open("< $blosxom::datadir$path/$chunk") || $fh->open("< $blosxom::datadir$path/$chunk.$blosxom::flavour") and return join '', <$fh>;
59 } while ($path =~ s/(\/*[^\/]*)$// and $1);
69 Blosxom Plug-in: postheadprefoot
73 Appends the contents of any posthead.flavour (specific to a particular flavour)
74 or posthead (general, regardless of flavour) file found along a particular
75 category path/directory to the head.flavour.
77 Prepends the contents of any prefoot.flavour (specific to a particular flavour)
78 or prefoot (general, regardless of flavour) file found along a particular
79 category path/directory to the foot.flavour.
81 In both cases, the plug-in prefers the posthead or prefoot found closest to
82 the point of the path at hand. Also, preference is given to the flavour
83 specific versus general version.
89 Version number coincides with the version of Blosxom with which the
90 current version was first bundled.
94 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
98 Drop into your Blosxom plug-in directory ($plugin_dir).
100 Optionally, you can gussie up the included posthead or prefoot
101 by altering the $posthead and $prefoot variables in the
102 Configurable Variables section. Just be sure to include
103 $posthead and $prefoot where the respective includes should go.
107 Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
109 Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
113 Address bug reports and comments to the Blosxom mailing list
114 [http://www.yahoogroups.com/group/blosxom].
118 Blosxom and this Blosxom Plug-in
119 Copyright 2003, Rael Dornfest
121 Permission is hereby granted, free of charge, to any person obtaining a
122 copy of this software and associated documentation files (the "Software"),
123 to deal in the Software without restriction, including without limitation
124 the rights to use, copy, modify, merge, publish, distribute, sublicense,
125 and/or sell copies of the Software, and to permit persons to whom the
126 Software is furnished to do so, subject to the following conditions:
128 The above copyright notice and this permission notice shall be included
129 in all copies or substantial portions of the Software.
131 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
133 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
134 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
135 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
136 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
137 OTHER DEALINGS IN THE SOFTWARE.