make taglink support the same method for specifying link text as a regular
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 22 Sep 2007 17:07:51 +0000 (17:07 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 22 Sep 2007 17:07:51 +0000 (17:07 +0000)
wikilink

IkiWiki/Plugin/tag.pm
doc/plugins/tag.mdwn

index 29af3757630d880f320c21b5bb8191777487892d..276d67e03d4983c32242c6ee682637e0b5897b27 100644 (file)
@@ -57,12 +57,25 @@ sub preprocess_taglink (@) { #{{{
        if (! @_) {
                return "";
        }
-       preprocess_tag(@_);
        my %params=@_;
-       delete $params{page};
-       delete $params{destpage};
-       delete $params{preview};
-       return join(" ", map { "[[$_]]" } keys %params);
+       return join(" ", map {
+               if (/(.*)\|(.*)/) {
+                       my $tag=IkiWiki::linkpage($2);
+                       $tags{$params{page}}{$tag}=1;
+                       return htmllink($params{page}, $params{destpage},
+                               tagpage($tag),
+                               linktext => IkiWiki::pagetitle($1));
+               }
+               else {
+                       my $tag=IkiWiki::linkpage($_);
+                       $tags{$params{page}}{$tag}=1;
+                       return htmllink($params{page}, $params{destpage},
+                               tagpage($tag));
+               }
+       }
+       grep {
+               $_ ne 'page' && $_ ne 'destpage' && $_ ne 'preview'
+       } keys %params);
 } # }}}
 
 sub pagetemplate (@) { #{{{
index c221624cda34c636172334e868a616a3d7f6ddae..caffaa6924380dfdfcccbed97ad867a524105bd7 100644 (file)
@@ -14,6 +14,7 @@ feeds.
 If you want a visible [[WikiLink]] along with the tag, use taglink instead:
 
        \[[taglink foo]]
+       \[[taglink tagged_as_foo|foo]]
 
 This plugin has a configuration option. Set --tagbase=tags and links to tags
 will be located under the specified base page. If ikiwiki is configured