Talk:Documentation:wikical.pl
Add topicThe original version relies on the GNU/Linux `cal` command in order to work properly. Users of other Unix OSes, such as OS X, have problems due to different `cal` output. This is a slightly modified version that works with OS X's `cal` output, which is NetBSD cal.c v 1.10.
#!/usr/bin/perl # # Adapted for OS X. 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="1" cellspacing="0" cellpadding="2"'."\n"; while (<CAL>) { next if (/^$/); if (/^\s+[JFMASOND]\w/) { # month and year print "|+$_"; next; } if (/S\s+M\s+Tu\s+W\s+Th\s+F\s+S/) { # days of week @dow=split; print "|-\n| ".join(" || ",@dow)."\n"; next; } print "|-\n"; @days=chomp; @days=split; if ($days[0]==1) { $paddays=7-scalar(@days); while ($paddays--) { print "| |"; } } foreach $day (@days) { printf ("|'''[[{{PAGENAME}}/%4d-%02d-%02d|$day]]'''\n",$year,$month,$day); } } #end while print "|}\n";
mod of wikical.pl[edit]
This one has a different look and no links on each date. Also outputs the whole year at once.