Wikical.pl

Wikical.pl is a Perl script written to generate a MediaWiki-format table showing a calendar month, with links for each day to a subpage from the displayed page.

It was written specifically to make up for the lack of PhpWiki's CalendarPlugin. The format of the links matches that of CalendarPlugin, allowing for minimal migration issues.

To use: Run this script (with optional  and   options to provide month and year, respectively) and capture or select the output, then paste the output into the target MediaWiki page. Alternately, use this wikical CGI wrapper to generate wikical code via the web.


 * 1) !perl

use Getopt::Std;

getopt('my'); @nowdate=localtime(time);

$month=$opt_m?$opt_m:$nowdate[4]+1; $year=$opt_y?$opt_y:$nowdate[5]+1900;

open CAL, "cal $month $year|";

print "{| border cellspacing=0 cellpadding=2\n";

while () { if (/^\s+[A-Z]/) { # month and year print "|+$_"; next; }

if (/^Su/) { # days of week @dow=split; print "|-\n|".join("||",@dow)."\n"; next; }

print "|-\n";

@days=split; if ($days[0]==1) { $paddays=7-scalar(@days); while ($paddays--) { print "| |"; } }

foreach $day (@days) { printf ("|$day\n",$year,$month,$day); }

} #end while

print "|}\n";