Add ACTIONS variable to page.tmpl, which allows plugins to add arbitrary links to...
[ikiwiki.git] / IkiWiki / Plugin / skeleton.pm.example
1 #!/usr/bin/perl
2 # Ikiwiki skeleton plugin. Replace "skeleton" with the name of your plugin
3 # in the lines below, remove hooks you don't use, and flesh out the code to
4 # make it do something.
5 package IkiWiki::Plugin::skeleton;
6
7 use warnings;
8 use strict;
9 use IkiWiki 3.00;
10
11 sub import {
12         hook(type => "getopt", id => "skeleton",  call => \&getopt);
13         hook(type => "getsetup", id => "skeleton",  call => \&getsetup);
14         hook(type => "checkconfig", id => "skeleton", call => \&checkconfig);
15         hook(type => "refresh", id => "skeleton", call => \&refresh);
16         hook(type => "needsbuild", id => "skeleton", call => \&needsbuild);
17         hook(type => "preprocess", id => "skeleton", call => \&preprocess);
18         hook(type => "filter", id => "skeleton", call => \&filter);
19         hook(type => "linkify", id => "skeleton", call => \&linkify);
20         hook(type => "scan", id => "skeleton", call => \&scan);
21         hook(type => "htmlize", id => "skeleton", call => \&htmlize);
22         hook(type => "sanitize", id => "skeleton", call => \&sanitize);
23         hook(type => "postscan", id => "skeleton", call => \&postscan);
24         hook(type => "format", id => "skeleton", call => \&format);
25         hook(type => "pagetemplate", id => "skeleton", call => \&pagetemplate);
26         hook(type => "templatefile", id => "skeleton", call => \&templatefile);
27         hook(type => "pageactions", id => "skeleton", call => \&pageactions);
28         hook(type => "delete", id => "skeleton", call => \&delete);
29         hook(type => "change", id => "skeleton", call => \&change);
30         hook(type => "cgi", id => "skeleton", call => \&cgi);
31         hook(type => "auth", id => "skeleton", call => \&auth);
32         hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
33         hook(type => "canedit", id => "skeleton", call => \&canedit);
34         hook(type => "canremove", id => "skeleton", call => \&canremove);
35         hook(type => "canrename", id => "skeleton", call => \&canrename);
36         hook(type => "checkcontent", id => "skeleton", call => \&checkcontent);
37         hook(type => "editcontent", id => "skeleton", call => \&editcontent);
38         hook(type => "formbuilder_setup", id => "skeleton", call => \&formbuilder_setup);
39         hook(type => "formbuilder", id => "skeleton", call => \&formbuilder);
40         hook(type => "renamepage", id => "skeleton", call => \&renamepage);
41         hook(type => "rename", id => "skeleton", call => \&rename);
42         hook(type => "savestate", id => "skeleton", call => \&savestate);
43         hook(type => "genwrapper", id => "skeleton", call => \&genwrapper);
44 }
45
46 sub getopt () {
47         debug("skeleton plugin getopt");
48 }
49
50 sub getsetup () {
51         return
52                 plugin => {
53                         safe => 1,
54                         rebuild => undef,
55                 },
56                 skeleton => {
57                         type => "boolean",
58                         example => 0,
59                         description => "example option",
60                         safe => 0,
61                         rebuild => 0,
62                 },
63 }
64
65 sub checkconfig () {
66         debug("skeleton plugin checkconfig");
67 }
68
69 sub refresh () {
70         debug("skeleton plugin refresh");
71 }
72
73 sub needsbuild () {
74         debug("skeleton plugin needsbuild");
75 }
76
77 sub preprocess (@) {
78         my %params=@_;
79
80         return "skeleton plugin result";
81 }
82
83 sub filter (@) {
84         my %params=@_;
85         
86         debug("skeleton plugin running as filter");
87
88         return $params{content};
89 }
90
91 sub linkify (@) {
92         my %params=@_;
93         
94         debug("skeleton plugin running as linkify");
95
96         return $params{content};
97 }
98
99 sub scan (@) {
100         my %params=@_;
101
102         debug("skeleton plugin running as scan");
103 }
104
105 sub htmlize (@) {
106         my %params=@_;
107
108         debug("skeleton plugin running as htmlize");
109
110         return $params{content};
111 }
112
113 sub sanitize (@) {
114         my %params=@_;
115         
116         debug("skeleton plugin running as a sanitizer");
117
118         return $params{content};
119 }
120
121 sub postscan (@) {
122         my %params=@_;
123         
124         debug("skeleton plugin running as postscan");
125 }
126
127 sub format (@) {
128         my %params=@_;
129         
130         debug("skeleton plugin running as a formatter");
131
132         return $params{content};
133 }
134
135 sub pagetemplate (@) {
136         my %params=@_;
137         my $page=$params{page};
138         my $template=$params{template};
139         
140         debug("skeleton plugin running as a pagetemplate hook");
141 }
142
143 sub templatefile (@) {
144         my %params=@_;
145         my $page=$params{page};
146         
147         debug("skeleton plugin running as a templatefile hook");
148 }
149
150 sub pageactions (@) {
151         my %params=@_;
152         my $page=$params{page};
153
154         debug("skeleton plugin running as a pageactions hook");
155         return ();
156 }
157
158 sub delete (@) {
159         my @files=@_;
160
161         debug("skeleton plugin told that files were deleted: @files");
162 }
163
164 sub change (@) {
165         my @files=@_;
166
167         debug("skeleton plugin told that changed files were rendered: @files");
168 }
169
170 sub cgi ($) {
171         my $cgi=shift;
172
173         debug("skeleton plugin running in cgi");
174 }
175
176 sub auth ($$) {
177         my $cgi=shift;
178         my $session=shift;
179
180         debug("skeleton plugin running in auth");
181 }
182
183 sub sessioncgi ($$) {
184         my $cgi=shift;
185         my $session=shift;
186
187         debug("skeleton plugin running in sessioncgi");
188 }
189
190 sub canedit ($$$) {
191         my $page=shift;
192         my $cgi=shift;
193         my $session=shift;
194
195         debug("skeleton plugin running in canedit");
196 }
197
198 sub canremove (@) {
199         my %params=@_;
200
201         debug("skeleton plugin running in canremove");
202 }
203
204 sub canrename (@) {
205         my %params=@_;
206
207         debug("skeleton plugin running in canrename");
208 }
209
210 sub checkcontent (@) {
211         my %params=@_;
212
213         debug("skeleton plugin running in checkcontent");
214 }
215
216 sub editcontent ($$$) {
217         my %params=@_;
218
219         debug("skeleton plugin running in editcontent");
220
221         return $params{content};
222 }
223
224 sub formbuilder_setup (@) {
225         my %params=@_;
226         
227         debug("skeleton plugin running in formbuilder_setup");
228 }
229
230 sub formbuilder (@) {
231         my %params=@_;
232         
233         debug("skeleton plugin running in formbuilder");
234 }
235
236 sub renamepage (@) {
237         my %params=@_;
238         
239         debug("skeleton plugin running in renamepage");
240 }
241
242 sub rename (@) {
243         my %params=@_;
244         
245         debug("skeleton plugin running in rename");
246 }
247
248 sub savestate () {
249         debug("skeleton plugin running in savestate");
250 }
251
252 sub genwrapper () {
253         debug("skeleton plugin running in genwrapper");
254 }
255
256 1