1 # Blosxom Plugin: storytags
2 # Author(s): Gavin Carr <gavin@openfusion.com.au>
4 # Documentation: See the bottom of this file or type: perldoc storytags
12 # Uncomment next line to enable debug output (don't uncomment debug() lines)
13 #use Blosxom::Debug debug_level => 1;
15 use vars qw($taglist @taglist);
17 # --- Configuration variables -----
20 my $prefix = 'Tags: ';
23 # ---------------------------------
32 my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
34 return 1 unless $tags::tag_cache
35 && ref $tags::tag_cache
36 && keys %{ $tags::tag_cache };
37 return 1 unless defined $tags::tag_cache->{"$path/$filename"};
40 @taglist = sort { lc $a cmp lc $b } split /\s*,\s*/,
41 $tags::tag_cache->{"$path/$filename"}->{tags}
42 if defined $tags::tag_cache->{"$path/$filename"}->{tags};
43 $taglist = _format_taglist( \@taglist );
50 return '' unless @$tags;
53 map { qq(<a href="$blosxom::url/tags/$_" rel="tag">$_</a>) }
65 storytags - blosxom plugin to format a per-story $storytags::taglist string
66 and @storytags::taglist array of tags
70 L<storytags> is a blosxom plugin to format a per-story $storytags::taglist
71 string, and a @storytags::taglist array of tags. The $taglist is a
72 comma-separated list of the tags defined for the story, prefixed by
73 $storytags::prefix, and suffixed by $storytags::suffix. If no tags are
74 defined, then $taglist will be the empty string '' (i.e. no prefix and
75 suffix are added). @taglist is a simple array of the tags for the story,
76 and an empty array if none are set.
78 The default values for $prefix and $suffix are 'Tags: ' and '. '
79 respectively, so a typical $taglist might look like:
81 Tags: dogs, cats, pets.
85 L<storytags> requires the L<tags> plugin, and should be loaded AFTER
86 L<tags>. It has no other ordering dependencies.
88 =head1 ACKNOWLEDGEMENTS
90 This plugin was inspired by xtaran's excellent L<tagging> plugin,
91 which includes similar functionality.
95 L<tags>, L<tagcloud>, xtaran's L<tagging>.
97 Blosxom: http://blosxom.sourceforge.net/
101 Gavin Carr <gavin@openfusion.com.au>, http://www.openfusion.net/
105 Copyright 2007, Gavin Carr.
107 This plugin is licensed under the same terms as blosxom itself i.e.
109 Permission is hereby granted, free of charge, to any person obtaining a
110 copy of this software and associated documentation files (the "Software"),
111 to deal in the Software without restriction, including without limitation
112 the rights to use, copy, modify, merge, publish, distribute, sublicense,
113 and/or sell copies of the Software, and to permit persons to whom the
114 Software is furnished to do so, subject to the following conditions:
116 The above copyright notice and this permission notice shall be included
117 in all copies or substantial portions of the Software.
119 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
120 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
121 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
122 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
123 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
124 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
125 OTHER DEALINGS IN THE SOFTWARE.