# Blosxom Plugin: authorcategory # Author(s): Matthew Miller # Inspired by fauxami plugin by Rael Dornfest # Version: .1 # Documentation: See the bottom of this file or type: perldoc authorcategory package authorcategory; # --- Configurable variables ----- # What should I consider a delimiter between poster's name and the rest of the # filename (e.g. . for jack.story1.txt)? my $delimiter = '\.'; # What should I consider a delimiter between the poster's first and last name? # (e.g. _ for John_Doe)? my $namedelimiter = '_'; # What should I fall back to as the default name (leave blank for none)? my $default_name = 'Staff'; # What should the category that generates the list of authors be called? Make # sure you do not have a directory with the same name in your blosxom $datadir. my $topcategory_name = "authors"; # From how many posts back should authors be included? my $postsbackto = 10000; # -------------------------------- use File::stat; my $authorname, $name, %allauthors, $dateflavour; sub start { $blosxom::num_entries = $postsbackto; # Check URL to see if author category is being requested: $ENV{PATH_INFO} =~ m!^/($topcategory_name)(.*)!; (my $requested, $authorname) = ($1, $2); $authorname =~ s!/!!; # Remove slashes from requested author $blosxom::path_info = ''; return ($requested eq $topcategory_name) ? 1 : 0; } sub template { return sub { my ($path, $chunk, $flavour) = @_; # Can't actually add date when date chunk is called, because it is called # before &story is run and checks if the entry will be shown: return '' if ($chunk eq 'date'); $dateflavour = $flavour; # Remember flavour so &story can grab it open(TEMPLATE, "<$blosxom::datadir/$chunk.$flavour"); my $thischunk; while(