ddf2996d64ace9c2dce9a6f9e6222f041de85e98
[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 => "delete", id => "skeleton", call => \&delete);
28         hook(type => "change", id => "skeleton", call => \&change);
29         hook(type => "cgi", id => "skeleton", call => \&cgi);
30         hook(type => "auth", id => "skeleton", call => \&auth);
31         hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
32         hook(type => "canedit", id => "skeleton", call => \&canedit);
33         hook(type => "canremove", id => "skeleton", call => \&canremove);
34         hook(type => "canrename", id => "skeleton", call => \&canrename);
35         hook(type => "checkcontent", id => "skeleton", call => \&checkcontent);
36         hook(type => "editcontent", id => "skeleton", call => \&editcontent);
37         hook(type => "formbuilder_setup", id => "skeleton", call => \&formbuilder_setup);
38         hook(type => "formbuilder", id => "skeleton", call => \&formbuilder);
39         hook(type => "renamepage", id => "skeleton", call => \&renamepage);
40         hook(type => "rename", id => "skeleton", call => \&rename);
41         hook(type => "savestate", id => "skeleton", call => \&savestate);
42         hook(type => "genwrapper", id => "skeleton", call => \&genwrapper);
43 }
44
45 sub getopt () {
46         debug("skeleton plugin getopt");
47 }
48
49 sub getsetup () {
50         return
51                 plugin => {
52                         safe => 1,
53                         rebuild => undef,
54                 },
55                 skeleton => {
56                         type => "boolean",
57                         example => 0,
58                         description => "example option",
59                         safe => 0,
60                         rebuild => 0,
61                 },
62 }
63
64 sub checkconfig () {
65         debug("skeleton plugin checkconfig");
66 }
67
68 sub refresh () {
69         debug("skeleton plugin refresh");
70 }
71
72 sub needsbuild () {
73         debug("skeleton plugin needsbuild");
74 }
75
76 sub preprocess (@) {
77         my %params=@_;
78
79         return "skeleton plugin result";
80 }
81
82 sub filter (@) {
83         my %params=@_;
84         
85         debug("skeleton plugin running as filter");
86
87         return $params{content};
88 }
89
90 sub linkify (@) {
91         my %params=@_;
92         
93         debug("skeleton plugin running as linkify");
94
95         return $params{content};
96 }
97
98 sub scan (@) {
99         my %params=@_;
100
101         debug("skeleton plugin running as scan");
102 }
103
104 sub htmlize (@) {
105         my %params=@_;
106
107         debug("skeleton plugin running as htmlize");
108
109         return $params{content};
110 }
111
112 sub sanitize (@) {
113         my %params=@_;
114         
115         debug("skeleton plugin running as a sanitizer");
116
117         return $params{content};
118 }
119
120 sub postscan (@) {
121         my %params=@_;
122         
123         debug("skeleton plugin running as postscan");
124 }
125
126 sub format (@) {
127         my %params=@_;
128         
129         debug("skeleton plugin running as a formatter");
130
131         return $params{content};
132 }
133
134 sub pagetemplate (@) {
135         my %params=@_;
136         my $page=$params{page};
137         my $template=$params{template};
138         
139         debug("skeleton plugin running as a pagetemplate hook");
140 }
141
142 sub templatefile (@) {
143         my %params=@_;
144         my $page=$params{page};
145         
146         debug("skeleton plugin running as a templatefile hook");
147 }
148
149 sub delete (@) {
150         my @files=@_;
151
152         debug("skeleton plugin told that files were deleted: @files");
153 }
154
155 sub change (@) {
156         my @files=@_;
157
158         debug("skeleton plugin told that changed files were rendered: @files");
159 }
160
161 sub cgi ($) {
162         my $cgi=shift;
163
164         debug("skeleton plugin running in cgi");
165 }
166
167 sub auth ($$) {
168         my $cgi=shift;
169         my $session=shift;
170
171         debug("skeleton plugin running in auth");
172 }
173
174 sub sessioncgi ($$) {
175         my $cgi=shift;
176         my $session=shift;
177
178         debug("skeleton plugin running in sessioncgi");
179 }
180
181 sub canedit ($$$) {
182         my $page=shift;
183         my $cgi=shift;
184         my $session=shift;
185
186         debug("skeleton plugin running in canedit");
187 }
188
189 sub canremove (@) {
190         my %params=@_;
191
192         debug("skeleton plugin running in canremove");
193 }
194
195 sub canrename (@) {
196         my %params=@_;
197
198         debug("skeleton plugin running in canrename");
199 }
200
201 sub checkcontent (@) {
202         my %params=@_;
203
204         debug("skeleton plugin running in checkcontent");
205 }
206
207 sub editcontent ($$$) {
208         my %params=@_;
209
210         debug("skeleton plugin running in editcontent");
211
212         return $params{content};
213 }
214
215 sub formbuilder_setup (@) {
216         my %params=@_;
217         
218         debug("skeleton plugin running in formbuilder_setup");
219 }
220
221 sub formbuilder (@) {
222         my %params=@_;
223         
224         debug("skeleton plugin running in formbuilder");
225 }
226
227 sub renamepage (@) {
228         my %params=@_;
229         
230         debug("skeleton plugin running in renamepage");
231 }
232
233 sub rename (@) {
234         my %params=@_;
235         
236         debug("skeleton plugin running in rename");
237 }
238
239 sub savestate () {
240         debug("skeleton plugin running in savestate");
241 }
242
243 sub genwrapper () {
244         debug("skeleton plugin running in genwrapper");
245 }
246
247 1