tags 443344 pending patch
thanks

also sprach Joey Hess <[EMAIL PROTECTED]> [2007.09.21.1750 +0100]:
> [EMAIL PROTECTED]:~/src/ikiwiki>grep taglink IkiWiki/Plugin/tag.pm 
>         hook(type => "preprocess", id => "taglink", call => 
> \&preprocess_taglink, scan => 1);

Hm, I was looking at r4440 for some reason and did not see r4436...
sorry.

Anyway, the generated link should probably include the tagbase:

diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm
index 29af375..8476f20 100644
--- a/IkiWiki/Plugin/tag.pm
+++ b/IkiWiki/Plugin/tag.pm
@@ -62,7 +62,7 @@ sub preprocess_taglink (@) { #{{{
        delete $params{page};
        delete $params{destpage};
        delete $params{preview};
-       return join(" ", map { "[[$_]]" } keys %params);
+       return join(" ", map { "[[".tagpage($_)."]]" } keys %params);
 } # }}}
 
 sub pagetemplate (@) { #{{{

But all this said, taglink isn't exactly what I was looking for.
I wanted more link than [[tag]] semantics, so instead of the ability
to create tags and links and multiple of them:

  [[taglink foo bar]]

I wanted something like

  [[taglink foo text="Link text"]]

which expands to

  [[Link text|$tagbase/foo]][[tag foo]]

but since you showed me now how to do it, here's another patch. It
does what I want, but it probably does not yet properly escape the
link text.

diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm
index 29af375..6dbccb5 100644
--- a/IkiWiki/Plugin/tag.pm
+++ b/IkiWiki/Plugin/tag.pm
@@ -12,6 +12,7 @@ sub import { #{{{
        hook(type => "getopt", id => "tag", call => \&getopt);
        hook(type => "preprocess", id => "tag", call => \&preprocess_tag, scan 
=> 1);
        hook(type => "preprocess", id => "taglink", call => 
\&preprocess_taglink, scan => 1);
+       hook(type => "preprocess", id => "linktag", call => 
\&preprocess_linktag, scan => 1);
        hook(type => "pagetemplate", id => "tag", call => \&pagetemplate);
 } # }}}
 
@@ -53,6 +54,18 @@ sub preprocess_tag (@) { #{{{
        return "";
 } # }}}
 
+sub preprocess_linktag (@) { #{{{
+       if (! @_) {
+               return "";
+       }
+       preprocess_tag(@_);
+       my [EMAIL PROTECTED];
+       my $key = shift;
+       my $prefix = '';
+       my $prefix="$params{text}|" if defined $params{text};
+       return "[[$prefix".tagpage($key)."]]";
+} # }}}
+
 sub preprocess_taglink (@) { #{{{
        if (! @_) {
                return "";

-- 
 .''`.   martin f. krafft <[EMAIL PROTECTED]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

Reply via email to