<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;

sub import { #{{{
	IkiWiki::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`;

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

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