]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/hnb.pm
comment: Don't show comments of subpages on parent pages. (Fixes bug introduced in...
[git.ikiwiki.info.git] / IkiWiki / Plugin / hnb.pm
index 846b0f2c9333f27c2356fecca9d679cba8159964..5157a6b93ce54c80ffac7330e50033cde57eddb4 100644 (file)
@@ -10,21 +10,31 @@ package IkiWiki::Plugin::hnb;
 
 use warnings;
 use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 use File::Temp qw(:mktemp);
 
 sub import {
+       hook(type => "getsetup", id => "hnb", call => \&getsetup);
        hook(type => "htmlize", id => "hnb", call => \&htmlize);
 }
 
+sub getsetup () {
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => 1, # format plugin
+                       section => "format",
+               },
+}
+
 sub htmlize (@) {
        my %params = @_;
 
        # hnb outputs version number etc. every time to STDOUT, so
        # using files makes it easier to seprarate.
 
-       my $tmpin  = mkstemp( "/tmp/ikiwiki-hnbin.XXXXXXXXXX"  );
-       my $tmpout = mkstemp( "/tmp/ikiwiki-hnbout.XXXXXXXXXX" );
+       my ($infh, $tmpin)  = mkstemp( "/tmp/ikiwiki-hnbin.XXXXXXXXXX"  );
+       my ($outfh, $tmpout) = mkstemp( "/tmp/ikiwiki-hnbout.XXXXXXXXXX" );
 
        open(TMP, '>', $tmpin) or die "Can't write to $tmpin: $!";
        print TMP $params{content};