2 package IkiWiki::Plugin::wmd;
11 hook(type => "getsetup", id => "wmd", call => \&getsetup);
12 hook(type => "formbuilder_setup", id => "wmd", call => \&formbuilder_setup);
24 sub formbuilder_setup (@) {
26 my $form=$params{form};
28 return if ! defined $form->field("do");
30 return unless $form->field("do") eq "edit" ||
31 $form->field("do") eq "create" ||
32 $form->field("do") eq "comment";
34 $form->tmpl_param("wmd_preview", "<div class=\"wmd-preview\"></div>\n".
35 include_javascript(undef, 1));
38 sub include_javascript ($;$) {
42 my $wmdjs=urlto("wmd/wmd.js", $page, $absolute);
44 <script type="text/javascript">
49 <script src="$wmdjs" type="text/javascript"></script>