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