]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/directive_docs.mdwn
note that the master branch also ahs this
[ikiwiki.git] / doc / todo / directive_docs.mdwn
1 The current basewiki is not [[self-documenting|todo/basewiki_should_be_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
4 docwiki or basewiki.
5
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
9 directives like that.
10
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..) 
16
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
22 (eg, brokenlinks).
23
24 Either way requires a lot of reorganisation/doc work, and an onging
25 maintenance load.
26
27 > Which has now been [[done]].  -- [[Will]]
28
29 BTW, this patch would be needed for the second approach, to allow
30 listdirectives to map from preprocessor directives back to the plugin that
31 defined them:  --[[Joey]]
32
33     commit 0486b46a629cae19ce89492d5ac498bbf9b84f5f
34     Author: Joey Hess <joey@kodama.kitenet.net>
35     Date:   Mon Aug 25 15:38:51 2008 -0400
36     
37         record which plugins registered which hooks
38     
39     diff --git a/IkiWiki.pm b/IkiWiki.pm
40     index e476521..afe982a 100644
41     --- a/IkiWiki.pm
42     +++ b/IkiWiki.pm
43     @@ -493,6 +493,7 @@ sub loadplugins () {
44         return 1;
45      }
46      
47     +my $loading_plugin;
48      sub loadplugin ($) {
49         my $plugin=shift;
50      
51     @@ -502,14 +503,18 @@ sub loadplugin ($) {
52                          "$installdir/lib/ikiwiki") {
53                 if (defined $dir && -x "$dir/plugins/$plugin") {
54                         require IkiWiki::Plugin::external;
55     +                   $loading_plugin=$plugin;
56                         import IkiWiki::Plugin::external "$dir/plugins/$plugin";
57     +                   $loading_plugin=undef;
58                         $loaded_plugins{$plugin}=1;
59                         return 1;
60                 }
61         }
62      
63         my $mod="IkiWiki::Plugin::".possibly_foolish_untaint($plugin);
64     +   $loading_plugin=$plugin;
65         eval qq{use $mod};
66     +   $loading_plugin=undef;
67         if ($@) {
68                 error("Failed to load plugin $mod: $@");
69         }
70     @@ -1429,6 +1434,9 @@ sub hook (@) {
71      
72         return if $param{no_override} && exists $hooks{$param{type}}{$param{id}};
73         
74     +   # Record which plugin was being loaded when the hook was defined.
75     +   $param{plugin}=$loading_plugin if defined $loading_plugin;
76     +
77         $hooks{$param{type}}{$param{id}}=\%param;
78         return 1;
79      }