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