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