1 diff -up fortune.pm.ORIG fortune.pm.MODIFIED
2 --- fortune.pm.ORIG 2008-01-11 19:07:48.000000000 +0100
3 +++ fortune.pm.MODIFIED 2008-01-12 07:58:44.000000000 +0100
6 -# Include a fortune in a page
7 +# Include a fortune in a page.
8 +# If the environment variable IKIWIKI_FORTUNE_COMMAND is defined, use it.
9 +# This allows to run e.g.:
10 +# $IKIWIKI_FORTUNE_COMMAND='fortune ~/.fortune/myfortunes' \
11 +# ikiwiki -setup ~/.ikiwiki/ikiwiki.setup
12 +# Combining this with cron could make regenerated wiki content.
13 +# This may or may not be a good thing wrt. version control.
14 package IkiWiki::Plugin::fortune;
17 @@ -12,7 +18,13 @@ sub import { #{{{
19 sub preprocess (@) { #{{{
20 $ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games";
21 - my $f = `fortune 2>/dev/null`;
23 + if (exists ($ENV{'IKIWIKI_FORTUNE_COMMAND'})) {
24 + $f = `$ENV{'IKIWIKI_FORTUNE_COMMAND'} 2>/dev/null`
27 + $f = `fortune 2>/dev/null`;
31 return "[[".gettext("fortune failed")."]]";