<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# Include a fortune in a page
package IkiWiki::Plugin::fortune;

use warnings;
use strict;
use IkiWiki 2.00;

sub import { #{{{
	hook(type =&gt; "preprocess", id =&gt; "fortune", call =&gt; \&amp;preprocess);
} # }}}

sub preprocess (@) { #{{{
	$ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games";
	my $f = `fortune 2&gt;/dev/null`;

	if ($?) {
		error gettext("fortune failed");
	}
	else {
		return "&lt;pre&gt;$f&lt;/pre&gt;\n";
	}
} # }}}

1
</pre></body></html>