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