From: Gavin Carr Date: Wed, 7 Nov 2007 23:02:29 +0000 (+0000) Subject: Add flavour handling to tags. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=b4d0840a866dec5cdc609b4a7feddf4f74bc182d;p=matthijs%2Fupstream%2Fblosxom-plugins.git Add flavour handling to tags. --- diff --git a/gavinc/tags b/gavinc/tags index 0202f85..9282ea2 100644 --- a/gavinc/tags +++ b/gavinc/tags @@ -55,8 +55,18 @@ sub entries { # debug(3, "entries, path_info $path_info"); if ($path_info =~ m!^$tagroot/(.*)!) { + $blosxom::flavour = ''; my $taglist = $1; # debug(3, "entries, path_info matches tagroot (taglist $taglist)"); + + # Allow flavours appended to tags after a slash + # Dot-flavour versions are problematic, because tags can include dot e.g. web2.0 + if ($taglist =~ m! /(\w+)$ !x) { + $blosxom::flavour = $1; + $taglist =~ s! /$blosxom::flavour$ !!x; + } + + # Split individual tags out of taglist if ($taglist =~ m/;/) { @path_tags = split /\s*;\s*/, $taglist; $path_tags_op = ';'; @@ -67,6 +77,7 @@ sub entries { } # If $path_info matches $tagroot it's a virtual path, so reset $blosxom::path_info = ''; + $blosxom::flavour ||= $blosxom::default_flavour; } return 0; @@ -211,6 +222,25 @@ OR semantics. =back +Tag filtering also supports a trailing flavour after the taglist, +separated by a slash e.g. + + /tags/dogs/html + /tags/dogs,cats/rss + /tags/dogs;cats;pets/atom + +Note that this is different to L, which treats trailing +components as additional tags. + +At this point L don't support dot-flavour paths e.g. + + /tags/mysql.html + +The problem with this is that tags can include dots, so it's +ambiguous how to parse C, for instance. If you'd +like this supported and have suggestions about how to handle +the ambiguities, please get in touch. + =head1 USAGE L should be loaded early as it modifies blosxom $path_info when