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