Revert rss20 to using $ENV{PATH_INFO} in self link.
[blosxom-plugins.git] / xtaran / pathbasedtagging
blobf70df5078d744bd233f524bb3e25c2356aada3a8
1 # -*- perl -*-
2 # Blosxom Plugin: pathbasedtagging
3 # Author(s): Axel Beckert <blosxom@deuxchevaux.org>, http://noone.org/blog
4 # Version: 0.01
5 # Licensing: GPL v2 or newer, http://www.gnu.org/licenses/gpl.txt
6 # Tagging plugin web page: http://noone.org/blog?-tags=Tagging
7 # Path Based Tagging plugin download: http://noone.org/blosxom/pathbasedtagging
8 # Blosxom web page: http://blosxom.ookee.com/
10 ### Documentation:
12 # This is a plugin for blosxom.
14 # Installation:
16 #  You should use plugin sorted by numbers with this plugin. Drop it
17 #  into your blosxoms plugin directory and prefix it with a quite low
18 #  two digit number (e.g. 02) which should be lower than the number of
19 #  plugins having an entries subroutine, e.g entries_index or
20 #  entries_cache. The tagging plugin itself should have a higher
21 #  number than those plugins. (I use 02pathbasedtagging,
22 #  05entries_index and 25tagging.)
24 #  If you want, change some of the configuration variables below.
26 # What it does:
28 #  In your blog, it handles any (virtual) directory named tag or tags
29 #  special and remaps the beginning of the URL and the tags coming
30 #  after that virtual directory in a way the tagging plugin can work
31 #  as usual.
33 # Configuration:
35 #  You can change the regular expression for matching the special
36 #  directory name. You may want to configure the tagging plugin to use
37 #  the blosxom_tags linking style.
39 # How to use it:
41 #  Instead of URLs like http://blog/cgi-bin/blosxom.cgi?-tags=foo,bar
42 #  you now can use http://blog/cgi-bin/blosxom.cgi/tags/foo/bar
44 # Version History:
46 #  0.01:   Initial release, together with tagging 0.04
49 package pathbasedtagging;
51 use CGI qw(:standard);
53 ###
54 ### Configuration
55 ###
57 my $re = qr/tags?/i;
59 ###
60 ### The plugin itself
61 ###
63 sub start {
64     1;
67 sub entries {
68     if ($blosxom::path_info =~ m!(^|/)$re/!) {
69         $blosxom::path_info = $`;
70         my $tags = $';
72         # Allow multiple tags separated by slashes
73         $tags =~ s(/)(,)g;
75         # Pass them via CGI.pm to the tagging plugin which does all
76         # the filtering
77         CGI::param(-name => '-tags', -value => $tags);
78     }
80     # Keep the default method of searching entries
81     return undef;