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