aboutsummaryrefslogtreecommitdiff
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
parentee3e0e3c50b5463f9612ce79c1c5a4d402a0071c (diff)
downloadikiwiki-d9633de2ce0fe0624348486d453f278aaf9ca61f.tar
ikiwiki-d9633de2ce0fe0624348486d453f278aaf9ca61f.tar.gz
* fortune plugin (trivial)
-rw-r--r--IkiWiki/Plugin/fortune.pm25
-rwxr-xr-xMakefile.PL3
-rw-r--r--debian/changelog1
-rw-r--r--doc/plugins/fortune.mdwn12
4 files changed, 40 insertions, 1 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
diff --git a/Makefile.PL b/Makefile.PL
index 58a6b29c3..641964853 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -17,7 +17,8 @@ extra_build:
--exclude=/discussion --no-discussion \
--plugin=brokenlinks --plugin=pagecount \
--plugin=orphans --plugin=haiku --plugin=meta \
- --plugin=tag --plugin=polygen --plugin=pagestats
+ --plugin=tag --plugin=polygen --plugin=pagestats \
+ --plugin=fortune
./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
diff --git a/debian/changelog b/debian/changelog
index 7685f9603..15fc13483 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,7 @@ ikiwiki (1.12) unstable; urgency=low
* Allow preprocessor directives to be expanded in inlined blog pages.
However, to avoid inlining loops etc, don't expand inline directives in
inlined pages.
+ * fortune plugin (trivial)
-- Joey Hess <joeyh@debian.org> Sat, 29 Jul 2006 17:12:56 -0400
diff --git a/doc/plugins/fortune.mdwn b/doc/plugins/fortune.mdwn
new file mode 100644
index 000000000..3f740e47a
--- /dev/null
+++ b/doc/plugins/fortune.mdwn
@@ -0,0 +1,12 @@
+This just uses the `fortune` program to insert a fortune into the page.
+Usage:
+
+ \[[fortune ]]
+
+This plugin is included in ikiwiki, but not enabled by default.
+
+If this plugin is enabled, here's a fortune for you:
+
+----
+
+[[fortune ]]