summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/skeleton.pm.example
blob: 708d9283019a5e2dd2b806bd59315d88a13824e7 (plain)
  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. use warnings;
  7. use strict;
  8. use IkiWiki 3.00;
  9. sub import {
  10. hook(type => "getopt", id => "skeleton", call => \&getopt);
  11. hook(type => "getsetup", id => "skeleton", call => \&getsetup);
  12. hook(type => "checkconfig", id => "skeleton", call => \&checkconfig);
  13. hook(type => "refresh", id => "skeleton", call => \&refresh);
  14. hook(type => "needsbuild", id => "skeleton", call => \&needsbuild);
  15. hook(type => "preprocess", id => "skeleton", call => \&preprocess);
  16. hook(type => "filter", id => "skeleton", call => \&filter);
  17. hook(type => "linkify", id => "skeleton", call => \&linkify);
  18. hook(type => "scan", id => "skeleton", call => \&scan);
  19. hook(type => "rescan", id => "skeleton", call => \&rescan);
  20. hook(type => "htmlize", id => "skeleton", call => \&htmlize);
  21. hook(type => "sanitize", id => "skeleton", call => \&sanitize);
  22. hook(type => "indexhtml", id => "skeleton", call => \&indexhtml);
  23. hook(type => "format", id => "skeleton", call => \&format);
  24. hook(type => "pagetemplate", id => "skeleton", call => \&pagetemplate);
  25. hook(type => "templatefile", id => "skeleton", call => \&templatefile);
  26. hook(type => "pageactions", id => "skeleton", call => \&pageactions);
  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. hook(type => "disable", id => "skeleton", call => \&disable);
  44. }
  45. sub getopt () {
  46. debug("skeleton plugin getopt");
  47. }
  48. sub getsetup () {
  49. return
  50. plugin => {
  51. safe => 1,
  52. rebuild => undef,
  53. section => "misc",
  54. },
  55. skeleton => {
  56. type => "boolean",
  57. example => 0,
  58. description => "example option",
  59. safe => 0,
  60. rebuild => 0,
  61. },
  62. }
  63. sub checkconfig () {
  64. debug("skeleton plugin checkconfig");
  65. }
  66. sub refresh () {
  67. debug("skeleton plugin refresh");
  68. }
  69. sub needsbuild ($) {
  70. debug("skeleton plugin needsbuild");
  71. }
  72. sub preprocess (@) {
  73. my %params=@_;
  74. return "skeleton plugin result";
  75. }
  76. sub filter (@) {
  77. my %params=@_;
  78. debug("skeleton plugin running as filter");
  79. return $params{content};
  80. }
  81. sub linkify (@) {
  82. my %params=@_;
  83. debug("skeleton plugin running as linkify");
  84. return $params{content};
  85. }
  86. sub scan (@) {
  87. my %params=@_;
  88. debug("skeleton plugin running as scan");
  89. }
  90. sub rescan (@) {
  91. my %params=@_;
  92. debug("skeleton plugin running as rescan");
  93. }
  94. sub htmlize (@) {
  95. my %params=@_;
  96. debug("skeleton plugin running as htmlize");
  97. return $params{content};
  98. }
  99. sub sanitize (@) {
  100. my %params=@_;
  101. debug("skeleton plugin running as a sanitizer");
  102. return $params{content};
  103. }
  104. sub indexhtml (@) {
  105. my %params=@_;
  106. debug("skeleton plugin running as indexhtml");
  107. }
  108. sub format (@) {
  109. my %params=@_;
  110. debug("skeleton plugin running as a formatter");
  111. return $params{content};
  112. }
  113. sub pagetemplate (@) {
  114. my %params=@_;
  115. my $page=$params{page};
  116. my $template=$params{template};
  117. debug("skeleton plugin running as a pagetemplate hook");
  118. }
  119. sub templatefile (@) {
  120. my %params=@_;
  121. my $page=$params{page};
  122. debug("skeleton plugin running as a templatefile hook");
  123. }
  124. sub pageactions (@) {
  125. my %params=@_;
  126. my $page=$params{page};
  127. debug("skeleton plugin running as a pageactions hook");
  128. return ();
  129. }
  130. sub delete (@) {
  131. my @files=@_;
  132. debug("skeleton plugin told that files were deleted: @files");
  133. }
  134. sub change (@) {
  135. my @files=@_;
  136. debug("skeleton plugin told that changed files were rendered: @files");
  137. }
  138. sub cgi ($) {
  139. my $cgi=shift;
  140. debug("skeleton plugin running in cgi");
  141. }
  142. sub auth ($$) {
  143. my $cgi=shift;
  144. my $session=shift;
  145. debug("skeleton plugin running in auth");
  146. }
  147. sub sessioncgi ($$) {
  148. my $cgi=shift;
  149. my $session=shift;
  150. debug("skeleton plugin running in sessioncgi");
  151. }
  152. sub canedit ($$$) {
  153. my $page=shift;
  154. my $cgi=shift;
  155. my $session=shift;
  156. debug("skeleton plugin running in canedit");
  157. }
  158. sub canremove (@) {
  159. my %params=@_;
  160. debug("skeleton plugin running in canremove");
  161. }
  162. sub canrename (@) {
  163. my %params=@_;
  164. debug("skeleton plugin running in canrename");
  165. }
  166. sub checkcontent (@) {
  167. my %params=@_;
  168. debug("skeleton plugin running in checkcontent");
  169. }
  170. sub editcontent ($$$) {
  171. my %params=@_;
  172. debug("skeleton plugin running in editcontent");
  173. return $params{content};
  174. }
  175. sub formbuilder_setup (@) {
  176. my %params=@_;
  177. debug("skeleton plugin running in formbuilder_setup");
  178. }
  179. sub formbuilder (@) {
  180. my %params=@_;
  181. debug("skeleton plugin running in formbuilder");
  182. }
  183. sub renamepage (@) {
  184. my %params=@_;
  185. debug("skeleton plugin running in renamepage");
  186. }
  187. sub rename (@) {
  188. my %params=@_;
  189. debug("skeleton plugin running in rename");
  190. }
  191. sub savestate () {
  192. debug("skeleton plugin running in savestate");
  193. }
  194. sub genwrapper () {
  195. debug("skeleton plugin running in genwrapper");
  196. }
  197. sub savestate () {
  198. debug("skeleton plugin running in disable");
  199. }
  200. 1