]> scripts.mit.edu Git - www/ikiwiki.git/blob - doc/todo/be_more_selective_about_running_hooks.mdwn
(no commit message)
[www/ikiwiki.git] / doc / todo / be_more_selective_about_running_hooks.mdwn
1 [[!template  id=gitbranch branch=chrismgray/exclusive-hooks author="[[chrismgray]]"]]
2
3 Sometimes plugins register a function with `hook`, but they only want
4 the function called with the content that they know how to deal with.
5 Normally, this means that they call `pagetype` first thing in the
6 function, determine if they know how to deal with the content, and
7 only do anything if they do.  
8
9 This is a bit wasteful in itself, but for external plugins, it's
10 really bad.  For functions like `scan` and `linkify`, where the entire
11 page is sent back and forth over `stdout` and `stdin`, it really slows
12 things down.  
13
14 Thus, I propose that there be a new optional parameter to `hook` that
15 tells it that the function should only be called for files whose type
16 is the same as the id of the plugin calling `hook`.  I have called
17 this parameter `exclusive` in my branch, but this might not be the
18 best name.
19
20 [[!tag patch]]