X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/35ee7e44a62f9126a83c1243b549d47cc5ca7b43..eeb9568c708f7cca2a93032dd300b394d669494a:/IkiWiki/Plugin/tag.pm diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index ddb67c2a8..733d76f4e 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -40,10 +40,11 @@ sub preprocess (@) { #{{{ my $page = $params{page}; delete $params{page}; delete $params{destpage}; + delete $params{preview}; - $tags{$page} = []; foreach my $tag (keys %params) { - push @{$tags{$page}}, $tag; + $tag=IkiWiki::linkpage($tag); + $tags{$page}{$tag}=1; # hidden WikiLink push @{$links{$page}}, tagpage($tag); } @@ -60,13 +61,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 => "pubdate")) { - # It's an rss template. Add any categories. - if (exists $tags{$page} && @{$tags{$page}}) { - $template->param(categories => [map { category => $_ }, @{$tags{$page}}]); + 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 => $_ }, + sort keys %{$tags{$page}}]); } } } # }}}