]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/tag.pm
* Allow multiple tag settings to appear in a single page.
[ikiwiki.git] / IkiWiki / Plugin / tag.pm
index 29d1d030a2e328088feb1244d98e934b226dc227..b06eadd13d055bb31fda8567581caa8278a76ab9 100644 (file)
@@ -41,9 +41,8 @@ sub preprocess (@) { #{{{
        delete $params{page};
        delete $params{destpage};
 
-       $tags{$page} = [];
        foreach my $tag (keys %params) {
-               push @{$tags{$page}}, $tag;
+               $tags{$page}{$tag}=1;
                # hidden WikiLink
                push @{$links{$page}}, tagpage($tag);
        }
@@ -60,13 +59,14 @@ sub pagetemplate (@) { #{{{
        $template->param(tags => [
                map { 
                        link => htmllink($page, $destpage, tagpage($_))
-               }, @{$tags{$page}}
-       ]) if exists $tags{$page} && @{$tags{$page}} && $template->query(name => "tags");
+               }, sort keys %{$tags{$page}}
+       ]) if exists $tags{$page} && %{$tags{$page}} && $template->query(name => "tags");
 
        if ($template->query(name => "categories")) {
                # It's an rss/atom template. Add any categories.
-               if (exists $tags{$page} && @{$tags{$page}}) {
-                       $template->param(categories => [map { category => $_ }, @{$tags{$page}}]);
+               if (exists $tags{$page} && %{$tags{$page}}) {
+                       $template->param(categories => [map { category => $_ },
+                               sort keys %{$tags{$page}}]);
                }
        }
 } # }}}