diff options
author | spalax <spalax@web> | 2014-01-13 16:23:43 -0400 |
---|---|---|
committer | admin <admin@branchable.com> | 2014-01-13 16:23:43 -0400 |
commit | df405eb1253e4f9c45465efc1751a0cbe2845b5e (patch) | |
tree | 31f19f4e7cfebaf28f38353b378e0341060ece3c | |
parent | 4b418dce999f777031faf08b2265ee2546f370c7 (diff) | |
download | ikiwiki-df405eb1253e4f9c45465efc1751a0cbe2845b5e.tar ikiwiki-df405eb1253e4f9c45465efc1751a0cbe2845b5e.tar.gz |
Solution?
-rw-r--r-- | doc/forum/inject__95__preprocess__95__tag.mdwn | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/forum/inject__95__preprocess__95__tag.mdwn b/doc/forum/inject__95__preprocess__95__tag.mdwn index bf2bc4f90..2b41b5b76 100644 --- a/doc/forum/inject__95__preprocess__95__tag.mdwn +++ b/doc/forum/inject__95__preprocess__95__tag.mdwn @@ -48,3 +48,28 @@ Here is the full code of (a very early version of) my plugin. 1 -- [[Louis|spalax]] + +> Hello, +> I managed to replace the tag original `preprocess_tag` function, using a different approach than using `inject`: +> +> my $orig_preprocess_tag; +> +> sub import { +> IkiWiki::loadplugin("tag"); +> $orig_preprocess_tag = \&{$IkiWiki::hooks{preprocess}{tag}{call}}; +> hook(type => "preprocess", id => "tag", call => \&my_preprocess_tag); +> } +> +> And later on, I can call the original `preprocess_tag` function using: +> +> $orig_preprocess_tag->(...) +> +> The problem is that I am digging into `IkiWiki.pm` package to extract data from `IkiWiki::hooks`, which is not guaranteed to work in the future, contrary to `inject`. +> +> Two questions: +> +> - how ugly is my solution? +> - is it possible to use `inject` to replace the `IkiWiki::Plugin::tag::preprocess_tag` function? +> +> -- [[Louis|spalax]] + |