# Blosxom Plugin: exclude # Author(s): Breyten Ernsting; ported to Blosxom3alpha by Stu MacKenzie # Version: 0+3i (port version 0+1i) #package exclude; package Blosxom::Plugin::exclude; # --- Configurable variables ----- my $ign_file = 'exclude'; # current users note this change! # (I really hate invisible files) # -------------------------------- sub start { my $self = shift; # $ign_fp = ($blosxom::path_info) ? "$blosxom::datadir/$blosxom::path_info" : "$blosxom::datadir"; $ign_fp = $self->{request}->{path_info} != m/^\/$/ ? "$self->{settings}->{find_entries_dir}$self->{request}->{path_info}" : "$self->{settings}->{find_entries_dir}/"; # $ign_ext = (-e "$ign_fp/${ign_file}.${blosxom::flavour}") ? ".${blosxom::flavour}" : ""; $ign_ext = (-e "$ign_fp/$ign_file.$self->{request}->{flavour}") ? ".$self->{request}->{flavour}" : ""; # $ign_fn = "$ign_fp/$ign_file$ign_ext"; $ign_fn = "$ign_fp$ign_file$ign_ext"; @excludes = (); open(EXCLUDE, "< $ign_fn") or 1; while () { chomp; # push(@excludes, "$ign_fp/$_") if $_; push(@excludes, "$ign_fp$_") if $_; } close(EXCLUDE); 1; } sub filter { # my ($pkg, $files_ref) = @_; my $self = shift; # my @files_list = keys %$files_ref; my @files_list = keys %{$self->{entries}}; foreach $exclude (@excludes) { foreach $ign_cf (@files_list) { # $ign_cf !~ m/^$exclude/ or delete $files_ref->{$ign_cf}; $ign_cf !~ m/^$exclude/ or delete $self->{entries}->{$ign_cf}; } } 1; } 1; __DATA__ __END__ =head1 NAME Blosxom Plug-in: exclude =head1 SYNOPSIS Purpose: ignores files and directories in entries. This file does not make any new variables available for use in template files. =head1 VERSION 0+1i 1st test release =head1 AUTHOR Breyten J. Ernsting http://www.bje.nu/ ported to Blosxom3 alpha by Stu MacKenzie =head1 BUGS Probably ;) =head1 INSTALLATION To use blox3: First, drop this file into the Blosxom3 plugins folder; Second, rename this file to: exclude3.pm Third, add two lines to your "handlers.entry" file -- at the _top_ of the file add 'Blosxom::Plugin::exclude::start' (no quotes) and just _after_ 'Blosxom::filter_entry_by_path' add 'Blosxom::Plugin::exclude::filter' (no quotes) NOTE: make sure you save the handlers.entry file with 'nix lineneds, not Mac returns Fourth, it oughta work. NOTE: if you are using the "blok3" plugin, you should remove it; its functionality is built into blox3. You can either delete blok3, or change its name to "blok_pm". =head1 CONFIGURATION C<$ign_file> name to use for exclude files. Defaults to C. =head1 EXAMPLE Your C should look like this: apps/ life/about.txt One entry per line. You should be able to use regexes. =head1 LICENSE this Blosxom Plug-in Copyright 2003, Breyten Ernsting (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.