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