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