2 package IkiWiki::Plugin::wmd;
10 hook(type => "getsetup", id => "wmd", call => \&getsetup);
11 hook(type => "formbuilder_setup", id => "wmd", call => \&formbuilder_setup);
23 sub formbuilder_setup (@) {
25 my $form=$params{form};
27 return if ! defined $form->field("do");
29 return unless $form->field("do") eq "edit" ||
30 $form->field("do") eq "create" ||
31 $form->field("do") eq "comment";
33 $form->tmpl_param("wmd_preview", "<div class=\"wmd-preview\"></div>\n".
34 include_javascript(undef, 1));
37 sub include_javascript ($;$) {
41 my $wmdjs=urlto("wmd/wmd.js", $page, $absolute);
43 <script type="text/javascript">
48 <script src="$wmdjs" type="text/javascript"></script>