X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/903213e63fd6c409046f66e73881aba33c3926de..578d59567a0f84fe62016fbbd4caf98509e14049:/IkiWiki/Plugin/hnb.pm diff --git a/IkiWiki/Plugin/hnb.pm b/IkiWiki/Plugin/hnb.pm index 40e4f9452..5157a6b93 100644 --- a/IkiWiki/Plugin/hnb.pm +++ b/IkiWiki/Plugin/hnb.pm @@ -10,30 +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 { #{{{ +sub import { hook(type => "getsetup", id => "hnb", call => \&getsetup); hook(type => "htmlize", id => "hnb", call => \&htmlize); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, # format plugin + section => "format", }, -} #}}} +} -sub htmlize (@) { #{{{ +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}; @@ -52,6 +53,6 @@ sub htmlize (@) { #{{{ $ret =~ s/.*//si; return $ret; -} #}}} +} 1;