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