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