#!/usr/bin/perl -w # Blosxom Plugin: technoratitags # Author: Michael Still (mikal@stillhq.com) # Version: 0+1i # Blosxom Home/Docs/Licensing: http://www.raelity.org/blosxom # Categories plugin Home/Docs/Licensing: # http://www.stillhq.com/cgi-bin/blosxom/blosxom/ use strict; package technoratitags; # --- Configuration Variables --- # Leading is used as the HTML before the tags my $leading = "

Technorati tags for this post:"; # Trailing is the same thing, but at the end of the tags my $trailing = ""; # Want to override one of the path entries that is used as a default? Do it here... my %override; $override{"diary"} = "blog"; # --- End of Configuration Section --- sub start { return 1; } sub story { my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_; my($tags, $tag, $deftags); if($$body_ref =~ /\[tags: *(.*)\]$/) { $tags = ""; foreach $tag (split / /, $1) { if($tag ne "") { $tags = "$tags $tag "; } } # Turn the path into something which is helpful as a tag $deftags = ""; foreach $tag (split /\//, $path) { if($tag ne "") { if($override{$tag} ne "") { $tag = $override{$tag}; } $deftags = "$deftags $tag "; } } $tags = "$leading$deftags$tags$trailing"; $$body_ref =~ s/\[tags:.*\]/$tags/; } return 1; } 1;