aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-29 20:01:29 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-29 20:01:29 +0000
commit35c90a5b582f0d40a122b151580e313c2b157b6f (patch)
treee7c73eb33d0ef8f84bba531aebdf9b3cd172b042
parent3a2dfb94cbe475faa16f0329ffc5e75f330d1afa (diff)
downloadikiwiki-35c90a5b582f0d40a122b151580e313c2b157b6f.tar
ikiwiki-35c90a5b582f0d40a122b151580e313c2b157b6f.tar.gz
"Viva l'Italia!"
* Polygen plugin from Enrico.
-rw-r--r--IkiWiki/Plugin/polygen.pm56
-rwxr-xr-xMakefile.PL2
-rw-r--r--debian/changelog2
-rw-r--r--doc/plugins/pagestats.mdwn4
-rw-r--r--doc/plugins/polygen.mdwn26
5 files changed, 88 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/polygen.pm b/IkiWiki/Plugin/polygen.pm
new file mode 100644
index 000000000..c14889167
--- /dev/null
+++ b/IkiWiki/Plugin/polygen.pm
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#
+# Include polygen output in a page
+#
+# by Enrico Zini
+package IkiWiki::Plugin::polygen;
+
+use warnings;
+use strict;
+use IkiWiki;
+use File::Find;
+
+sub import { #{{{
+ IkiWiki::hook(type => "preprocess", id => "polygen",
+ call => \&preprocess);
+} # }}}
+
+sub preprocess (@) { #{{{
+ my %params=@_;
+ my $grammar = ($params{grammar} or 'polygen');
+ my $symbol = ($params{symbol} or undef);
+
+ # Sanitize parameters
+ $grammar =~ IkiWiki::basename($grammar);
+ $grammar =~ s/\.grm$//;
+ $grammar .= '.grm';
+ $symbol =~ s/[^A-Za-z0-9]//g if defined $symbol;
+
+ my $grmfile = '/usr/share/polygen/ita/polygen.grm';
+ find({wanted => sub {
+ if (substr($File::Find::name, -length($grammar)) eq $grammar) {
+ $grmfile = IkiWiki::possibly_foolish_untaint($File::Find::name);
+ }
+ },
+ no_chdir => 1,
+ }, '/usr/share/polygen');
+
+ my $res;
+ if (defined $symbol) {
+ $res = `polygen -S $symbol $grmfile 2>/dev/null`;
+ }
+ else {
+ $res = `polygen $grmfile 2>/dev/null`;
+ }
+
+ if ($?) {
+ $res="[[polygen failed]]";
+ }
+
+ # Strip trainling spaces and newlines so that we flow well with the
+ # markdown text
+ $res =~ s/\s*$//;
+ return $res;
+} # }}}
+
+1
diff --git a/Makefile.PL b/Makefile.PL
index 05547ff05..58a6b29c3 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -17,7 +17,7 @@ extra_build:
--exclude=/discussion --no-discussion \
--plugin=brokenlinks --plugin=pagecount \
--plugin=orphans --plugin=haiku --plugin=meta \
- --plugin=tag
+ --plugin=tag --plugin=polygen --plugin=pagestats
./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 84b806b3b..f4f0cffab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
ikiwiki (1.13) UNRELEASED; urgency=low
+ "Viva l'Italia!"
* New pagestats plugin from Enrico, which can generate a table counting
the backlinks for each page, or a del.icio.us style cloud.
* Build-depend on libtext-wikiformat-perl, so that the syntax check of
@@ -8,6 +9,7 @@ ikiwiki (1.13) UNRELEASED; urgency=low
display, running them through pagetitle. This removes ugly underscores and
other gunk from the display, much nicer. You may want to rebuild your wiki
when upgrading to get the cleanup globally.
+ * Polygen plugin from Enrico.
-- Joey Hess <joeyh@debian.org> Sat, 29 Jul 2006 14:22:18 -0400
diff --git a/doc/plugins/pagestats.mdwn b/doc/plugins/pagestats.mdwn
index 41c853b16..f750e3cb1 100644
--- a/doc/plugins/pagestats.mdwn
+++ b/doc/plugins/pagestats.mdwn
@@ -10,4 +10,6 @@ And here's how to create a table of all the pages on the wiki:
\[[pagestats style="table"]]
-This plugin is included in ikiwiki, but is not enabled by default.
+This plugin is included in ikiwiki, but is not enabled by default. If it is
+enabled, here's a link cloud for this entire wiki:
+[[pagestats ]]
diff --git a/doc/plugins/polygen.mdwn b/doc/plugins/polygen.mdwn
new file mode 100644
index 000000000..cc88f499f
--- /dev/null
+++ b/doc/plugins/polygen.mdwn
@@ -0,0 +1,26 @@
+This plugin allows inserting text generated by polygen into a wiki page.
+For example:
+
+ \[[polygen grammar="genius"]]
+
+It's also possible to specify a starting nonterminal for the grammar by
+including `symbol="text"` in the directive.
+
+This plugin is included in ikiwiki, but not enabled by default.
+
+If this plugin is enabled, and polygen is installed, here are a few notes
+about ikiwiki.
+
+----
+
+Ikiwiki is internally based on a [[polygen grammar="designpatterns"]]
+coupled to a [[polygen grammar="designpatterns"]], as described in
+"[[polygen grammar="paper2"]]" by [[polygen grammar="nipponame"]] of
+[[polygen grammar="boyband"]].
+
+Ikiwiki reviews:
+<ul>
+<li>[[polygen grammar="reviews"]]</li>
+<li>[[polygen grammar="reviews"]]</li>
+<li>[[polygen grammar="reviews"]]</li>
+</ul>