aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-29 21:53:57 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-29 21:53:57 +0000
commitd9633de2ce0fe0624348486d453f278aaf9ca61f (patch)
tree752868c51cf28c466792d1a6b9f51b5d9da6d693 /IkiWiki
parentee3e0e3c50b5463f9612ce79c1c5a4d402a0071c (diff)
downloadikiwiki-d9633de2ce0fe0624348486d453f278aaf9ca61f.tar
ikiwiki-d9633de2ce0fe0624348486d453f278aaf9ca61f.tar.gz
* fortune plugin (trivial)
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/fortune.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/fortune.pm b/IkiWiki/Plugin/fortune.pm
new file mode 100644
index 000000000..8e96bdbbd
--- /dev/null
+++ b/IkiWiki/Plugin/fortune.pm
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+# Include a fortune in a page
+package IkiWiki::Plugin::fortune;
+
+use warnings;
+use strict;
+
+sub import { #{{{
+ IkiWiki::hook(type => "preprocess", id => "fortune",
+ call => \&preprocess);
+} # }}}
+
+sub preprocess (@) { #{{{
+ $ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games";
+ my $f = `fortune`;
+
+ if ($?) {
+ return "[[fortune failed]]";
+ }
+ else {
+ return "<pre>$f</pre>\n";
+ }
+} # }}}
+
+1