Package: ikiwiki Version: 3.20100815.7 This is meant to be a slightly more generic version of the Action Tracker[0] plugin for TWiki. You can see that in use at the bottom of this page[1].
Sample usage: [[!event who="clint" date="2011-04-30" class="action" state="due" notify="kabukiman" priority="plaid" description="That thing"]] The only part I've implemented is the rendering of an HTML table. [0] http://twiki.org/cgi-bin/view/Plugins/ActionTrackerPlugin [1] http://emoglen.law.columbia.edu/twiki/bin/view/LawContempSoc/CitizensUnitedVFederalElectionCommission
package IkiWiki::Plugin::event; use warnings; use strict; use Encode; use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "event", call => \&getsetup); hook(type => "preprocess", id => "event", call => \&preprocess, scan => 1); } sub getsetup () { return plugin => { safe => 1, rebuild => undef, section => "widget", }, } sub preprocess (@) { my %params =( format => 'auto', header => 'row', @_ ); my @lines; push @lines, defined $params{class} ? "<table class=\"".$params{class}.'">' : '<table>'; push @lines, "\t<thead><th>Assigned to</th><th>Due date</th><th>Description</th><th>State</th><th>Notify</th></thead>"; push @lines, "\t<tbody>"; push @lines, defined $params{priority} ? "\t<tr class=\"".$params{priority}.'">' : "\t<tr>"; push @lines, "\t\t<td>".$params{who}."</td>" if defined $params{who}; push @lines, "\t\t<td>".$params{date}."</td>" if defined $params{date}; push @lines, "\t\t<td>".$params{description}."</td>" if defined $params{description}; push @lines, "\t\t<td>".$params{state}."</td>" if defined $params{state}; push @lines, "\t\t<td>".$params{notify}."</td>" if defined $params{notify}; push @lines, "\t</tr>"; push @lines, "\t</tbody>"; push @lines, '</table>'; my $html = join("\n", @lines); return $html; } 1;