]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/fortune.pm
Fix ugly display when editing a page that has vanished.
[git.ikiwiki.info.git] / IkiWiki / Plugin / fortune.pm
index 8e96bdbbd1e442be73b45586f3fd276b2ea9b0e2..a3b13f687dac48aa37eee64ddf2eb7035dbac064 100644 (file)
@@ -4,18 +4,18 @@ package IkiWiki::Plugin::fortune;
 
 use warnings;
 use strict;
+use IkiWiki 2.00;
 
 sub import { #{{{
-       IkiWiki::hook(type => "preprocess", id => "fortune",
-               call => \&preprocess);
+       hook(type => "preprocess", id => "fortune", call => \&preprocess);
 } # }}}
 
 sub preprocess (@) { #{{{
        $ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games";
-       my $f = `fortune`;
+       my $f = `fortune 2>/dev/null`;
 
        if ($?) {
-               return "[[fortune failed]]";
+               return "[[".gettext("fortune failed")."]]";
        }
        else {
                return "<pre>$f</pre>\n";