"Viva l'Italia!"

* Polygen plugin from Enrico.
master
joey 2006-07-29 20:01:29 +00:00
parent 3a2dfb94cb
commit 35c90a5b58
5 changed files with 88 additions and 2 deletions

View File

@ -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

View File

@ -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

2
debian/changelog vendored
View File

@ -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

View File

@ -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 ]]

View File

@ -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>