hook(type => "preprocess", id => "tag", call => \&preprocess_tag, scan => 1);
hook(type => "preprocess", id => "taglink", call => \&preprocess_taglink, scan => 1);
hook(type => "pagetemplate", id => "tag", call => \&pagetemplate);
hook(type => "preprocess", id => "tag", call => \&preprocess_tag, scan => 1);
hook(type => "preprocess", id => "taglink", call => \&preprocess_taglink, scan => 1);
hook(type => "pagetemplate", id => "tag", call => \&pagetemplate);
eval q{use Getopt::Long};
error($@) if $@;
Getopt::Long::Configure('pass_through');
GetOptions("tagbase=s" => \$config{tagbase});
eval q{use Getopt::Long};
error($@) if $@;
Getopt::Long::Configure('pass_through');
GetOptions("tagbase=s" => \$config{tagbase});
-sub preprocess_tag (@) { #{{{
+ return htmllink($page, $destpage, tagpage($tag), %opts);
+}
+
+sub preprocess_tag (@) {
- my $tag=IkiWiki::linkpage($2);
- $tags{$params{page}}{$tag}=1;
- push @{$links{$params{page}}}, tagpage($tag);
- return htmllink($params{page}, $params{destpage},
- tagpage($tag),
- linktext => IkiWiki::pagetitle($1));
+ my $tag=linkpage($2);
+ add_link($params{page}, tagpage($tag), 'tag');
+ return taglink($params{page}, $params{destpage}, $tag,
+ linktext => pagetitle($1));
- my $tag=IkiWiki::linkpage($_);
- $tags{$params{page}}{$tag}=1;
- push @{$links{$params{page}}}, tagpage($tag);
- return htmllink($params{page}, $params{destpage},
- tagpage($tag));
+ my $tag=linkpage($_);
+ add_link($params{page}, tagpage($tag), 'tag');
+ return taglink($params{page}, $params{destpage}, $tag);
- link => htmllink($page, $destpage, tagpage($_),
- rel => "tag")
- }, sort keys %{$tags{$page}}
- ]) if exists $tags{$page} && %{$tags{$page}} && $template->query(name => "tags");
+ link => taglink($page, $destpage, $_, rel => "tag")
+ }, sort keys %$tags
+ ]) if defined $tags && %$tags && $template->query(name => "tags");