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