X-Git-Url: http://git.tremily.us/?p=ikiwiki.git;a=blobdiff_plain;f=IkiWiki%2FPlugin%2Fhnb.pm;h=5157a6b93ce54c80ffac7330e50033cde57eddb4;hp=846b0f2c9333f27c2356fecca9d679cba8159964;hb=be60d261e6cbee094e4df74e1bb24c8ad3dc393d;hpb=78a7f6938f24e6ccf60b5a50400e728cb2b98ff9 diff --git a/IkiWiki/Plugin/hnb.pm b/IkiWiki/Plugin/hnb.pm index 846b0f2c9..5157a6b93 100644 --- a/IkiWiki/Plugin/hnb.pm +++ b/IkiWiki/Plugin/hnb.pm @@ -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};