aboutsummaryrefslogtreecommitdiff
path: root/doc/forum/inject__95__preprocess__95__tag.mdwn
diff options
context:
space:
mode:
authorspalax <spalax@web>2014-01-05 10:19:31 -0400
committeradmin <admin@branchable.com>2014-01-05 10:19:31 -0400
commit39ebfd9491f314b08862ae6bbf538f74caea2039 (patch)
tree0bde6a54d53d564f505f1a2a68b00d3cfb41c162 /doc/forum/inject__95__preprocess__95__tag.mdwn
parentaa35a1e7b32d6bfc8116697fcf41d657da29b2e6 (diff)
downloadikiwiki-39ebfd9491f314b08862ae6bbf538f74caea2039.tar
ikiwiki-39ebfd9491f314b08862ae6bbf538f74caea2039.tar.gz
Question about inject function
Diffstat (limited to 'doc/forum/inject__95__preprocess__95__tag.mdwn')
-rw-r--r--doc/forum/inject__95__preprocess__95__tag.mdwn50
1 files changed, 50 insertions, 0 deletions
diff --git a/doc/forum/inject__95__preprocess__95__tag.mdwn b/doc/forum/inject__95__preprocess__95__tag.mdwn
new file mode 100644
index 000000000..fe824d840
--- /dev/null
+++ b/doc/forum/inject__95__preprocess__95__tag.mdwn
@@ -0,0 +1,50 @@
+[[!meta title="Cannot manage to *inject* *preprocess_tag*"]]
+
+Hello,
+I am trying to write a plugin that changes the way the
+[[ikiwiki/directive/tag]] [[ikiwiki/directive]] works, and I am trying to do so
+by using the [[inject|plugins/write/#index81h3]] function. The piece of code
+that should (if I understood well the `inject` function) do the trick is :
+
+ sub import {
+ inject(
+ name => 'IkiWiki::Plugin::tag::preprocess_tag',
+ call => \&my_preprocess_tag
+ );
+ }
+
+Howere, this does not change anything about the effect of the `tag` directive.
+
+I have tried some variants, like calling `inject` outside the `import`
+function, or calling `IkiWiki::loadplugin("tag");` to ensure that the
+[[plugins/tag]] is loaded, but none of these things work. Any idea?
+
+*Disclaimer:* although proficient in several languages, I am a beginner in Perl.
+
+Here is the full code of (a very early version of) my plugin.
+
+ #! /usr/bin/perl
+ require 5.002;
+ package IkiWiki::Plugin::parenttag;
+
+ use warnings;
+ use strict;
+ use IkiWiki 3.00;
+
+ my $orig_preprocess_tag=\&preprocess_tag;
+
+ sub import {
+ inject(
+ name => 'IkiWiki::Plugin::tag::preprocess_tag',
+ call => \&my_preprocess_tag
+ );
+ }
+
+ sub my_preprocess_tag(@) {
+ print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nWorking!\n";
+ return "TODO";
+ }
+
+ 1
+
+-- [[Louis|spalax]]