summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/skeleton.pm.example
blob: ecf2a2407ca135d91503b4ebe3ed27d7bebf89f3 (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. hook(type => "targetpage", id => "skeleton", call => \&targetpage);
  36. hook(type => "urlpath", id => "skeleton", call => \&urlpath);
  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 (@) { #{{{a
  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. sub editcontent ($$$) { #{{{
  141. my %params=@_;
  142. debug("skeleton plugin running in editcontent");
  143. return $params{content};
  144. } #}}}
  145. sub formbuilder_setup (@) { #{{{
  146. my %params=@_;
  147. debug("skeleton plugin running in formbuilder_setup");
  148. } # }}}
  149. sub formbuilder (@) { #{{{
  150. my %params=@_;
  151. debug("skeleton plugin running in formbuilder");
  152. } # }}}
  153. sub savestate () { #{{{
  154. debug("skeleton plugin running in savestate");
  155. } #}}}
  156. sub targetpage () { #{{{
  157. debug("skeleton plugin running in targetpage");
  158. } #}}}
  159. sub urlpath () { #{{{
  160. debug("skeleton plugin running in urlpath");
  161. } #}}}
  162. 1