X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/bd7221ae5450e14e9641e01e0c2890a8f018ddb4..7a88638c6c47480817fdac02d0a45f1dd56b6d1d:/IkiWiki/Plugin/tag.pm diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index 55064a9a3..fd5ce1e8a 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -55,6 +55,17 @@ sub taglink ($) { return $tag; } +# Returns a tag name from a tag link +sub tagname ($) { + my $tag=shift; + if (defined $config{tagbase}) { + $tag =~ s!^/\Q$config{tagbase}\E/!!; + } else { + $tag =~ s!^\.?/!!; + } + return pagetitle($tag, 1); +} + sub htmllink_tag ($$$;@) { my $page=shift; my $destpage=shift; @@ -84,7 +95,7 @@ sub gentag ($) { debug($message); my $template=template("autotag.tmpl"); - $template->param(tagname => IkiWiki::basename($tag)); + $template->param(tagname => tagname($tag)); $template->param(tag => $tag); writefile($tagfile, $config{srcdir}, $template->output); if ($config{rcs}) { @@ -154,14 +165,15 @@ sub pagetemplate (@) { $template->param(tags => [ map { - link => htmllink_tag($page, $destpage, $_, rel => "tag") + link => htmllink_tag($page, $destpage, $_, + rel => "tag", linktext => tagname($_)) }, sort keys %$tags ]) if defined $tags && %$tags && $template->query(name => "tags"); if ($template->query(name => "categories")) { # It's an rss/atom template. Add any categories. if (defined $tags && %$tags) { - $template->param(categories => [map { category => $_ }, + $template->param(categories => [map { category => tagname($_) }, sort keys %$tags]); } }