Revert rss20 to using $ENV{PATH_INFO} in self link.
[blosxom-plugins.git] / general / postheadprefoot
blobea6315501ee57b56542d164f6e1ee25e8752e121
1 # Blosxom Plugin: postheadprefoot
2 # Author(s): Rael Dornfest <rael@oreilly.com> 
3 # Version: 2.0b4-5
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 # --------------------------------
24 use FileHandle;
26 my $fh = new FileHandle;
28 sub start {
29   1;
32 sub head {
33   my($pkg, $path, $head_ref) = @_;
34   
35   $posthead =~ s!\$posthead!load($path, 'posthead')!eis;
36   $$head_ref .= $posthead;
37   
38   1;
41 sub foot {
42   my($pkg, $path, $foot_ref) = @_;
43   
44   $prefoot =~ s!\$prefoot!load($path, 'prefoot')!eis;
45   $$foot_ref = $prefoot . $$foot_ref;
46   
47   1;
50 sub load { 
51   my($path, $chunk) = @_;
53   my($path,$fn) = $path =~ m!^(?:(.*)/)?(.*)\.$blosxom::flavour!;
55   $path =~ s!^/*!!; $path &&= "/$path";
57   do {
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);
65 __END__
67 =head1 NAME
69 Blosxom Plug-in: postheadprefoot
71 =head1 SYNOPSIS
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.
85 =head1 VERSION
87 2.0b4-5
89 Version number coincides with the version of Blosxom with which the 
90 current version was first bundled.
92 =head1 AUTHOR
94 Rael Dornfest  <rael@oreilly.com>, http://www.raelity.org/
96 This plugin is now maintained by the Blosxom Sourceforge Team,
97 <blosxom-devel@lists.sourceforge.net>.
99 =head1 INSTALLATION
101 Drop into your Blosxom plug-in directory ($plugin_dir).
103 Optionally, you can gussie up the included posthead or prefoot
104 by altering the $posthead and $prefoot variables in the 
105 Configurable Variables section.  Just be sure to include 
106 $posthead and $prefoot where the respective includes should go.
108 =head1 SEE ALSO
110 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
112 Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
114 =head1 BUGS
116 None known; please send bug reports and feedback to the Blosxom
117 development mailing list <blosxom-devel@lists.sourceforge.net>.
119 =head1 LICENSE
121 Blosxom and this Blosxom Plug-in
122 Copyright 2003, Rael Dornfest 
124 Permission is hereby granted, free of charge, to any person obtaining a
125 copy of this software and associated documentation files (the "Software"),
126 to deal in the Software without restriction, including without limitation
127 the rights to use, copy, modify, merge, publish, distribute, sublicense,
128 and/or sell copies of the Software, and to permit persons to whom the
129 Software is furnished to do so, subject to the following conditions:
131 The above copyright notice and this permission notice shall be included
132 in all copies or substantial portions of the Software.
134 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
135 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
136 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
137 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
138 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
139 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
140 OTHER DEALINGS IN THE SOFTWARE.