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