Fixed extraneous <updated>...</updated> tags for feed date/time in static rendering
[matthijs/upstream/blosxom-plugins.git] / general / fullcategory
1 # Blosxom Plugin: fullcategory
2 # Author(s): Mark Ivey <zovirl@zovirl.com>
3 # Version: 0.0.2
4 # Documentation: See the bottom of this file or type: perldoc fullcategory
5
6 package fullcategory;
7
8 # --- Configurable variables -----
9
10 # --------------------------------
11
12 # print debug messages or not?
13 my $debug = 1;
14
15 sub start 
16 {
17     return 1;
18 }
19
20 sub filter 
21 {
22     my($pkg, $files_ref) = @_;
23     
24     my $path = "$blosxom::datadir/$blosxom::path_info";
25     
26     # if there is a flavor, this is a story and we don't have to help blosxom
27     return if ($path =~ m!\.[^/]*?$!); 
28     
29     # the / on the end of $path is what prevents partial matches
30     $path .= "/";
31     $path =~ s!//$!/!;  # remove extra trailing /'s 
32
33     warn "fullcategory: path is [$path]\n" if $debug >= 1; 
34     
35     foreach my $file (keys %$files_ref)
36     {
37         my $string = "fullcategory: checking file [$file]: ";
38         unless ($file =~ m!^$path!)
39         {
40             delete $files_ref->{$file};
41             $string .= "deleted\n";
42         }
43         else
44         {
45             $string .= "kept\n";
46         }
47         warn $string if $debug >= 1;
48         
49     }
50
51     return 1;
52 }
53
54
55 1;
56
57 __END__
58
59 =head1 NAME
60
61 Blosxom Plug-in: fullcategory
62
63 =head1 SYNOPSIS
64
65 Changes blosxom behavior so full category names are required (partial names
66 will no longer work)
67
68 =head1 VERSION
69
70 0.0.2
71
72 =head1 AUTHOR
73
74 Mark Ivey <zovirl@zovirl.com>, http://zovirl.com
75
76 This plugin is now maintained by the Blosxom Sourceforge Team,
77 <blosxom-devel@lists.sourceforge.net>.
78
79 =head1 DESCRIPTION
80
81 fullcategory fixes blosxom so only complete category names will work.
82 By default, blosxom will return results for partial category name matches.
83 For example, if "telephone" is a category, these would all return posts about
84 telephones:
85 http://example.com/telephone
86 http://example.com/telepho
87 http://example.com/tele
88
89 (If "television" was also a category, that last example would include
90 posts from both the television & telephone categories)
91
92 =head1 SEE ALSO
93
94 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
95
96 Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
97
98 parsedate() taken from Fletcher T. Penney's entriescache plugin:
99 http://www.blosxom.com/plugins/indexing/entries_cache.htm
100
101 =head1 BUGS
102
103 None known; please send bug reports and feedback to the Blosxom
104 development mailing list <blosxom-devel@lists.sourceforge.net>.
105
106 =head1 LICENSE
107
108 fullcategory Blosxom Plugin Copyright 2004, Mark Ivey
109
110 Permission is hereby granted, free of charge, to any person obtaining a
111 copy of this software and associated documentation files (the "Software"),
112 to deal in the Software without restriction, including without limitation
113 the rights to use, copy, modify, merge, publish, distribute, sublicense,
114 and/or sell copies of the Software, and to permit persons to whom the
115 Software is furnished to do so, subject to the following conditions:
116
117 The above copyright notice and this permission notice shall be included
118 in all copies or substantial portions of the Software.
119
120 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
121 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
122 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
123 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
124 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
125 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
126 OTHER DEALINGS IN THE SOFTWARE.