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