summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-05-03 19:58:58 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-05-03 19:58:58 +0000
commita44bfb158dac9e04647a75bc819a73bc18f5acce (patch)
tree557f34948ad08be08dc5bdc1d768fe396b861984 /IkiWiki
parent4ba45ec3fc6d94657e23cecaca27bf4dc5c7c0a5 (diff)
change plugin interface to use named parameters for flexability
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/brokenlinks.pm3
-rw-r--r--IkiWiki/Plugin/inline.pm3
-rw-r--r--IkiWiki/Plugin/orphans.pm3
-rw-r--r--IkiWiki/Plugin/pagecount.pm3
-rw-r--r--IkiWiki/Plugin/skeleton.pm5
-rw-r--r--IkiWiki/Render.pm4
6 files changed, 13 insertions, 8 deletions
diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm
index 75c819d76..8b91391fe 100644
--- a/IkiWiki/Plugin/brokenlinks.pm
+++ b/IkiWiki/Plugin/brokenlinks.pm
@@ -7,7 +7,8 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::register_plugin("preprocess", "brokenlinks", \&preprocess);
+ IkiWiki::hook(type => "preprocess", id => "brokenlinks",
+ call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index c554774f6..61b4a8523 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -7,7 +7,8 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::register_plugin("preprocess", "inline", \&IkiWiki::preprocess_inline);
+ IkiWiki::hook(type => "preprocess", id => "inline",
+ call => \&IkiWiki::preprocess_inline);
} # }}}
# Back to ikiwiki namespace for the rest, this code is very much
diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
index bd3c6b8b9..945892d17 100644
--- a/IkiWiki/Plugin/orphans.pm
+++ b/IkiWiki/Plugin/orphans.pm
@@ -7,7 +7,8 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::register_plugin("preprocess", "orphans", \&preprocess);
+ IkiWiki::hook(type => "preprocess", id => "orphans",
+ call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm
index fc69e449b..8a1376e09 100644
--- a/IkiWiki/Plugin/pagecount.pm
+++ b/IkiWiki/Plugin/pagecount.pm
@@ -7,7 +7,8 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::register_plugin("preprocess", "pagecount", \&preprocess);
+ IkiWiki::hook(type => "preprocess", id => "pagecount",
+ call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
diff --git a/IkiWiki/Plugin/skeleton.pm b/IkiWiki/Plugin/skeleton.pm
index c9a7a421d..89308c45f 100644
--- a/IkiWiki/Plugin/skeleton.pm
+++ b/IkiWiki/Plugin/skeleton.pm
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# Ikiwiki skeleton plugin. Replace "skeleton" with the name of your plugin
-# in the lines below, and flesh out the methods to make it do something.
+# in the lines below, and flesh out the code to make it do something.
package IkiWiki::Plugin::skeleton;
use warnings;
@@ -8,7 +8,8 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::register_plugin("preprocess", "skeleton", \&preprocess);
+ IkiWiki::hook(type => "preprocess", id => "skeleton",
+ call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index be6e6d1cb..f90f16335 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -134,12 +134,12 @@ sub preprocess ($$) { #{{{
if (length $escape) {
return "[[$command $params]]";
}
- elsif (exists $plugins{preprocess}{$command}) {
+ elsif (exists $hooks{preprocess}{$command}) {
my %params;
while ($params =~ /(\w+)=\"([^"]+)"(\s+|$)/g) {
$params{$1}=$2;
}
- return $plugins{preprocess}{$command}->(page => $page, %params);
+ return $hooks{preprocess}{$command}{call}->(page => $page, %params);
}
else {
return "[[$command not processed]]";