3 package IkiWiki::Plugin::tag;
12 IkiWiki::hook(type => "preprocess", id => "tag",
13 call => \&preprocess);
14 IkiWiki::hook(type => "pagetemplate", id => "tag",
15 call => \&pagetemplate);
18 sub preprocess (@) { #{{{
23 my $page = $params{page};
25 delete $params{destpage};
28 foreach my $tag (keys %params) {
29 push @{$tags{$page}}, $tag;
31 push @{$IkiWiki::links{$page}}, $tag;
37 sub pagetemplate (@) { #{{{
39 my $page=$params{page};
40 my $destpage=$params{destpage};
41 my $template=$params{template};
43 $template->param(tags => [
44 map { link => IkiWiki::htmllink($page, $destpage, $_) },
46 ]) if exists $tags{$page} && @{$tags{$page}} && $template->query(name => "tags");