aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/firm_up_plugin_interface.mdwn
blob: c2e190884662eaab277e5e75770f91bb2fdb7480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Reopening this for 3.0, to consider adding new functions.

I don't want this interface to be too firm; it's ok for a plugin like
`ddate` to redefine an internal function like IkiWiki::displaytime if it
wants to.. But plugins that still access stuff through IkiWiki:: should be
aware that that stuff can change at any time and break them. Possibly without
perl's type checking catching the breakage, in some cases. Plugins that
only use exported symbols should not be broken by future ikiwiki changes.

## Most often used functions, by number of calls from plugin code

     27 IkiWiki::possibly_foolish_untaint

Not very happy about exporting, it's not ikiwiki-specific,
and plugins that need to untaint things should think about it, hard.

     12 IkiWiki::userinfo_get
      5 IkiWiki::userinfo_set

Used by only 4 plugins, all of which are fairly core, so thinking
don't export.

     11 IkiWiki::preprocess
      8 IkiWiki::filter
      4 IkiWiki::linkify
      4 IkiWiki::htmlize

The page rendering chain. Note that it's very common to call `preprocess(filter(text))`,
or `htmlize(linkify(preprocess(filter(text))))`, while `htmlize(linkify(preprocess(text))`
is called less frequently, and it's also not unheard of to leave out a step and do
`htmlize(preprocess(text))`. (I haven't checked if any of those cases are bugs.)

It would be nice if the api could avoid exposing the details of the render chain,
by providing a way to say "I have filtered text, and would like html", or "I have raw
text and would like to get it up to the preprocess stage".

Another problimatic thing is plugins often define functions named 'preprocess', etc.

     12 IkiWiki::linkpage
     11 IkiWiki::pagetitle
      6 IkiWiki::titlepage

These go together; linkpage is needed by all link plugins, and the others are used widely.
All should be exported. (Done)

      7 IkiWiki::saveindex
      5 IkiWiki::loadindex

Still too internal to ever be exported?

      7 IkiWiki::redirect

Only used by 4 plugins, and not in IkiWiki.pm itself, so probably not to be exported.

      7 IkiWiki::dirname
      4 IkiWiki::basename

Not ikiwiki-specific, don't export.

      6 IkiWiki::refresh

Very internal, not part of IkiWiki.pm, don't export.

      5 IkiWiki::yesno

Not ikiwiki-specific, but worth exporting to get a consistent localised yes/no parser
for directives.

      5 IkiWiki::showform
      4 IkiWiki::decode_form_utf8

Only used by 3 fairly core plugins, not in IkiWiki.pm, don't export.

      5 IkiWiki::rcs_update
      4 IkiWiki::rcs_prepedit
      5 IkiWiki::is_admin
      5 IkiWiki::cgi_savesession
      4 IkiWiki::cgiurl

Not enough use, I think, to export.

      5 IkiWiki::enable_commit_hook
      5 IkiWiki::disable_commit_hook

Deep internal magic, if exported people will use it wrong, only used by core plugins.

      4 IkiWiki::check_canedit

Probably needs to evolve more and be more widely used before being exported.

## Variables used by plugins but not exported yet

* %IkiWiki::pagecase (aggregate)
* %IkiWiki::backlinks (pagestats)