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