# Blosxom Plugin: worse_title # Author(s): Adrian Sampson http://caprahircus.ws/ # Tony Williams http://honestpuck.com/ # Version: 0.1 # Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/ # Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml # portions copyright 2005 Adrian Sampson # portions copyright 2003 Tony Williams # Released under the same License as Blosxom package worse_title; # --- Configurable variables ----- # characters between blog name and path or date my $name_sep = ': '; # characters between parts of the date my $date_sep = ' '; # -------------------------------- $title; # use as $worse_title::title in flavour templates sub start { 1; } sub head { my($pkg, $currentdir, $head_ref) = @_; $title = $blosxom::blog_title; $our_path = $blosxom::path_info; if ($our_path && ($our_path ne " ")) { if ($currentdir =~ m#(.*?)/?(.+)\.(.+)$# and $2 ne 'index') { $file = join('/', $blosxom::datadir, $1, "$2.$blosxom::file_extension"); my $fh = new FileHandle; if (-f "$file" && $fh->open("< $file")) { chomp($i_title = <$fh>); $fh->close; } } else { @a = split('/', $currentdir); $i_title = pop @a; $i_title = ucfirst($i_title); } } elsif ($blosxom::path_info_yr) { my $month = $blosxom::path_info_mo; if ($blosxom::path_info_mo =~ /^\d+$/) { my %num2month = ('01'=>'Jan', '02'=>'Feb', '03'=>'Mar', '04'=>'Apr', '05'=>'May', '06'=>'Jun', '07'=>'Jul', '08'=>'Aug', '09'=>'Sep', '10'=>'Oct', '11'=>'Nov', '12'=>'Dec'); $month = $num2month{$month}; } $i_title = join($date_sep,$month, $blosxom::path_info_da, $blosxom::path_info_yr); } if ($i_title) { $title = $blosxom::blog_title . $name_sep . $i_title; } } 1; __END__ =head1 NAME Blosxom Plug-in: C =head1 SYNOPSIS Purpose: Allows page titles to be more specific. =head1 VERSION 0.1 =head1 CONFIGURATION You can leave C with the defaults or customize your titles to your heart's content. =over =item C<$name_sep> This string will be placed between your blog's title (C<$blosxom::blog_title>) and the extra information generated by C. =item C<$date_sep> This string will be placed between elements of the date (ie, the day, month, and year). =back =head1 USAGE In flavour templates, use C<$worse_title::title> in place of C<$blosxom::blog_title>. =head1 AUTHORS Adrian Sampson L Tony Williams L =head1 HISTORY C 0.1 comprises a set of modifications to C by Tony Williams. The modifications are: =over =item * more reliably gets the title of individual entry (tolerates \W characters) =item * handles date URLs where month names (as opposed to numbers) are used =item * only the top folder in the path is displayed, and it is capitalized to emulate a human-comprehensible category =item * the plugin should work with C<$file_extension>s other than C =item * the default settings were changed for a more standard appearance =back =head1 LICENSE C Copyright 2005, Adrian Sampson and 2003, Tony Williams (This license is the same as Blosxom's.) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.