]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/fortune:_select_options_via_environment.mdwn
Add a comment about adding of per-wiki or per-user setting for the edit box size
[ikiwiki.git] / doc / todo / fortune:_select_options_via_environment.mdwn
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
4     @@ -1,5 +1,11 @@
5      #!/usr/bin/perl
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;
15
16      use warnings;
17     @@ -12,7 +18,13 @@ sub import {
18
19      sub preprocess (@) {
20             $ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games";
21     -       my $f = `fortune 2>/dev/null`;
22     +       my $f;
23     +       if (exists ($ENV{'IKIWIKI_FORTUNE_COMMAND'})) {
24     +           $f = `$ENV{'IKIWIKI_FORTUNE_COMMAND'} 2>/dev/null`
25     +       }
26     +       else {
27     +           $f = `fortune 2>/dev/null`;
28     +       }
29
30         if ($?) {
31                 return "[[".gettext("fortune failed")."]]";
32         
33 > An environment variable is not the right approach. Ikiwiki has a setup
34 > file, and plugins can use configuration from there. --[[Joey]]