X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom-plugins.git;a=blobdiff_plain;f=xtaran%2Fpathbasedtagging;fp=xtaran%2Fpathbasedtagging;h=f70df5078d744bd233f524bb3e25c2356aada3a8;hp=0000000000000000000000000000000000000000;hb=f411779f855bc712a621b9a3c6103ac9c6732403;hpb=8423e2bd76579f5f032cfb2cee41212ca9699055 diff --git a/xtaran/pathbasedtagging b/xtaran/pathbasedtagging new file mode 100644 index 0000000..f70df50 --- /dev/null +++ b/xtaran/pathbasedtagging @@ -0,0 +1,84 @@ +# -*- perl -*- +# Blosxom Plugin: pathbasedtagging +# Author(s): Axel Beckert , 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;