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