1 The current basewiki is not self-documenting. In particular, if
2 [[plugins/listdirectives]] is used, it creates a list with a bunch of
3 broken links to directives/*, pages that do not currently exist in the
6 This could be fixed by adding a page for each directive under to
7 `ikiwiki/directives`, and put those into a new underlay, which the plugin
8 could enable. Rather a lot of work and maintenance to document all the
11 I also considered having it link to the plugin that defined the
12 directive. Then all the plugins can be included in a new underlay, which
13 both [[plugins/listdirectives]] and [[plugins/websetup]] could enable.
14 (The latter could be improved by making the plugin names in the web setup
15 be links to docs about each plugin..)
17 The problem I ran into doing that is that the existing plugin pages have a
18 lot of stuff on them you probably don't want an underlay doing. The biggest
19 issues were wikilinks to other pages in the docwiki (which would end up
20 broken if the plugins were used as an underlay), and plugin pages that
21 include examples of the plugin in use, which are sometimes rather expensive
24 Either way requires a lot of reorganisation/doc work, and an onging
27 BTW, this patch would be needed for the second approach, to allow
28 listdirectives to map from preprocessor directives back to the plugin that
29 defined them: --[[Joey]]
31 commit 0486b46a629cae19ce89492d5ac498bbf9b84f5f
32 Author: Joey Hess <joey@kodama.kitenet.net>
33 Date: Mon Aug 25 15:38:51 2008 -0400
35 record which plugins registered which hooks
37 diff --git a/IkiWiki.pm b/IkiWiki.pm
38 index e476521..afe982a 100644
41 @@ -493,6 +493,7 @@ sub loadplugins () { #{{{
46 sub loadplugin ($) { #{{{
49 @@ -502,14 +503,18 @@ sub loadplugin ($) { #{{{
50 "$installdir/lib/ikiwiki") {
51 if (defined $dir && -x "$dir/plugins/$plugin") {
52 require IkiWiki::Plugin::external;
53 + $loading_plugin=$plugin;
54 import IkiWiki::Plugin::external "$dir/plugins/$plugin";
55 + $loading_plugin=undef;
56 $loaded_plugins{$plugin}=1;
61 my $mod="IkiWiki::Plugin::".possibly_foolish_untaint($plugin);
62 + $loading_plugin=$plugin;
64 + $loading_plugin=undef;
66 error("Failed to load plugin $mod: $@");
68 @@ -1429,6 +1434,9 @@ sub hook (@) { # {{{
70 return if $param{no_override} && exists $hooks{$param{type}}{$param{id}};
72 + # Record which plugin was being loaded when the hook was defined.
73 + $param{plugin}=$loading_plugin if defined $loading_plugin;
75 $hooks{$param{type}}{$param{id}}=\%param;